ALSA: usb-audio: fix uac control query argument
This patch fixes code readability and should have no functional change. Correct uac control query functions to account for the 1-based indexing of USB Audio Class control identifiers. The function parameter, u8 control, should be the constant defined in audio-v2.h to identify the control to be checked for readability or writeability. This patch fixes all callers that had adjusted, and makes explicit the mapping between audio_feature_info[] array index and the associated control identifier. Signed-off-by: Andrew Chant <achant@google.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:

committed by
Takashi Iwai

parent
9a2fe9b801
commit
21e9b3e931
@@ -214,7 +214,7 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip,
|
||||
|
||||
/* If a clock source can't tell us whether it's valid, we assume it is */
|
||||
if (!uac_v2v3_control_is_readable(bmControls,
|
||||
UAC2_CS_CONTROL_CLOCK_VALID - 1))
|
||||
UAC2_CS_CONTROL_CLOCK_VALID))
|
||||
return 1;
|
||||
|
||||
err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
|
||||
@@ -552,7 +552,8 @@ static int set_sample_rate_v2v3(struct snd_usb_audio *chip, int iface,
|
||||
bmControls = cs_desc->bmControls;
|
||||
}
|
||||
|
||||
writeable = uac_v2v3_control_is_writeable(bmControls, UAC2_CS_CONTROL_SAM_FREQ - 1);
|
||||
writeable = uac_v2v3_control_is_writeable(bmControls,
|
||||
UAC2_CS_CONTROL_SAM_FREQ);
|
||||
if (writeable) {
|
||||
data = cpu_to_le32(rate);
|
||||
err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR,
|
||||
|
Reference in New Issue
Block a user