diff options
author | Andrew Chant | 2018-03-22 14:39:55 -0700 |
---|---|---|
committer | Takashi Iwai | 2018-03-23 10:25:03 +0100 |
commit | 21e9b3e931f78497b19b1f8f3d59d19412c1a28f (patch) | |
tree | ceafcd8610b694895129a9d52da56672229ac791 /include/linux/usb/audio-v2.h | |
parent | 9a2fe9b801f585baccf8352d82839dcd54b300cf (diff) |
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>
Diffstat (limited to 'include/linux/usb/audio-v2.h')
-rw-r--r-- | include/linux/usb/audio-v2.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h index 2db83a191e78..aaafecf073ff 100644 --- a/include/linux/usb/audio-v2.h +++ b/include/linux/usb/audio-v2.h @@ -36,12 +36,12 @@ static inline bool uac_v2v3_control_is_readable(u32 bmControls, u8 control) { - return (bmControls >> (control * 2)) & 0x1; + return (bmControls >> ((control - 1) * 2)) & 0x1; } static inline bool uac_v2v3_control_is_writeable(u32 bmControls, u8 control) { - return (bmControls >> (control * 2)) & 0x2; + return (bmControls >> ((control - 1) * 2)) & 0x2; } /* 4.7.2 Class-Specific AC Interface Descriptor */ |