summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey D. Bennett <g@b4.vu>2021-06-21 02:16:47 +0930
committerTakashi Iwai <tiwai@suse.de>2021-06-21 08:37:57 +0200
commit64c02a9d3f9c8ca167c216acb86da02c1b7299b9 (patch)
treef4d6d9bc483ad8dc87cbabcef5497d584def595a
parentc5d8e008032f3cd5f266d552732973a960b0bd4b (diff)
ALSA: usb-audio: scarlett2: Fix union usage in mixer control callbacks
Fix mixer control callbacks to use the correct members of the struct snd_ctl_elem_value. The use of value.integer and value.enumerated were swapped in a few places. Update scarlett2_mux_src_enum_ctl_put() to use min() instead of clamp() as value.enumerated.item is unsigned. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164647.GA9226@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/usb/mixer_scarlett_gen2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
index fe142b7ddb32..49c4662531a3 100644
--- a/sound/usb/mixer_scarlett_gen2.c
+++ b/sound/usb/mixer_scarlett_gen2.c
@@ -1270,7 +1270,7 @@ static int scarlett2_sw_hw_enum_ctl_put(struct snd_kcontrol *kctl,
mutex_lock(&private->data_mutex);
oval = private->vol_sw_hw_switch[index];
- val = !!ucontrol->value.integer.value[0];
+ val = !!ucontrol->value.enumerated.item[0];
if (oval == val)
goto unlock;
@@ -1356,7 +1356,7 @@ static int scarlett2_level_enum_ctl_put(struct snd_kcontrol *kctl,
mutex_lock(&private->data_mutex);
oval = private->level_switch[index];
- val = !!ucontrol->value.integer.value[0];
+ val = !!ucontrol->value.enumerated.item[0];
if (oval == val)
goto unlock;
@@ -1390,7 +1390,7 @@ static int scarlett2_pad_ctl_get(struct snd_kcontrol *kctl,
struct usb_mixer_elem_info *elem = kctl->private_data;
struct scarlett2_data *private = elem->head.mixer->private_data;
- ucontrol->value.enumerated.item[0] =
+ ucontrol->value.integer.value[0] =
private->pad_switch[elem->control];
return 0;
}
@@ -1448,7 +1448,7 @@ static int scarlett2_dim_mute_ctl_get(struct snd_kcontrol *kctl,
scarlett2_update_volumes(mixer);
mutex_unlock(&private->data_mutex);
- ucontrol->value.enumerated.item[0] = private->dim_mute[elem->control];
+ ucontrol->value.integer.value[0] = private->dim_mute[elem->control];
return 0;
}
@@ -1748,8 +1748,8 @@ static int scarlett2_mux_src_enum_ctl_put(struct snd_kcontrol *kctl,
mutex_lock(&private->data_mutex);
oval = private->mux[index];
- val = clamp(ucontrol->value.integer.value[0],
- 0L, private->num_mux_srcs - 1L);
+ val = min(ucontrol->value.enumerated.item[0],
+ private->num_mux_srcs - 1U);
if (oval == val)
goto unlock;