From: Geoffrey D. Bennett Date: Sat, 25 Apr 2026 21:16:59 +0000 (+0930) Subject: ALSA: scarlett2: Fold min_firmware_version into config_sets X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec195d28b98ff5e7242d7fb51c1e1237035bd4d1;p=thirdparty%2Flinux.git ALSA: scarlett2: Fold min_firmware_version into config_sets The device info's min_firmware_version field encoded the oldest firmware the driver supports on each device. With the config_sets array in place, the first entry's from_firmware_version carries the same meaning (it's the oldest firmware range any config_set applies to). Merge the two by dropping min_firmware_version from scarlett2_device_info and reading config_sets[0].from_firmware_version at the three call sites that used it. No functional change. Signed-off-by: Geoffrey D. Bennett Signed-off-by: Takashi Iwai Link: https://patch.msgid.link/f2ca214b39c773c186adafc8726d6ff79f198459.1777151532.git.g@b4.vu --- diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c index 349aa2333053..70a276d3ae02 100644 --- a/sound/usb/mixer_scarlett2.c +++ b/sound/usb/mixer_scarlett2.c @@ -1117,9 +1117,6 @@ struct scarlett2_device_info { /* which sets of configuration parameters the device uses */ const struct scarlett2_config_set_entry *config_sets; - /* minimum firmware version required */ - u16 min_firmware_version; - /* has a downloadable device map */ u8 has_devmap; @@ -1848,7 +1845,6 @@ static const struct scarlett2_device_info vocaster_one_info = { { 1769, &scarlett2_config_set_vocaster }, { } }, - .min_firmware_version = 1769, .has_devmap = 1, .phantom_count = 1, @@ -1895,7 +1891,6 @@ static const struct scarlett2_device_info vocaster_two_info = { { 1769, &scarlett2_config_set_vocaster }, { } }, - .min_firmware_version = 1769, .has_devmap = 1, .phantom_count = 2, @@ -1943,7 +1938,6 @@ static const struct scarlett2_device_info solo_gen4_info = { { 2115, &scarlett2_config_set_gen4_solo }, { } }, - .min_firmware_version = 2115, .has_devmap = 1, .level_input_count = 1, @@ -2001,7 +1995,6 @@ static const struct scarlett2_device_info s2i2_gen4_info = { { 2115, &scarlett2_config_set_gen4_2i2 }, { } }, - .min_firmware_version = 2115, .has_devmap = 1, .level_input_count = 2, @@ -2059,7 +2052,6 @@ static const struct scarlett2_device_info s4i4_gen4_info = { { 2089, &scarlett2_config_set_gen4_4i4 }, { } }, - .min_firmware_version = 2089, .has_devmap = 1, .level_input_count = 2, @@ -3341,7 +3333,8 @@ static int scarlett2_min_firmware_version_ctl_get( struct usb_mixer_elem_info *elem = kctl->private_data; struct scarlett2_data *private = elem->head.mixer->private_data; - ucontrol->value.integer.value[0] = private->info->min_firmware_version; + ucontrol->value.integer.value[0] = + private->info->config_sets[0].from_firmware_version; return 0; } @@ -8568,6 +8561,7 @@ static int scarlett2_read_configs(struct usb_mixer_interface *mixer) { struct scarlett2_data *private = mixer->private_data; const struct scarlett2_device_info *info = private->info; + u16 min_firmware_version = info->config_sets[0].from_firmware_version; int err, i; if (scarlett2_has_config_item(private, SCARLETT2_CONFIG_MSD_SWITCH)) { @@ -8578,13 +8572,13 @@ static int scarlett2_read_configs(struct usb_mixer_interface *mixer) return err; } - if (private->firmware_version < info->min_firmware_version) { + if (private->firmware_version < min_firmware_version) { usb_audio_err(mixer->chip, "Focusrite %s firmware version %d is too old; " "need %d", private->series_name, private->firmware_version, - info->min_firmware_version); + min_firmware_version); return 0; } @@ -8768,6 +8762,7 @@ static int snd_scarlett2_controls_create( const struct scarlett2_device_entry *entry) { struct scarlett2_data *private; + u16 min_firmware_version; int err; /* Initialise private data */ @@ -8776,6 +8771,8 @@ static int snd_scarlett2_controls_create( return err; private = mixer->private_data; + min_firmware_version = + private->info->config_sets[0].from_firmware_version; /* Send proprietary USB initialisation sequence */ err = scarlett2_usb_init(mixer); @@ -8818,7 +8815,7 @@ static int snd_scarlett2_controls_create( * old, don't create any other controls */ if (private->msd_switch || - private->firmware_version < private->info->min_firmware_version) + private->firmware_version < min_firmware_version) return 0; /* Create the analogue output controls */