aboutsummaryrefslogtreecommitdiff
path: root/sound/usb
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2010-05-31 13:35:36 +0200
committerTakashi Iwai <tiwai@suse.de>2010-05-31 18:15:45 +0200
commitdcbe7bcfa32c5bc4f9bb6c75d4d41bb4db8c36fc (patch)
tree7cadc69ed8c6d3bd8df6f48cd640946b818200d6 /sound/usb
parent67a3e12b05e055c0415c556a315a3d3eb637e29e (diff)
ALSA: usb-audio: UAC2: clean up parsing of bmaControls
Introduce two new static inline functions for a more readable parsing of UAC2 bmaControls. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/mixer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 03ce971e002..43d6417b811 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1188,9 +1188,9 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
for (j = 0; j < channels; j++) {
unsigned int mask = snd_usb_combine_bytes(bmaControls + csize * (j+1), csize);
- if (mask & (1 << (i * 2))) {
+ if (uac2_control_is_readable(mask, i)) {
ch_bits |= (1 << j);
- if (~mask & (1 << ((i * 2) + 1)))
+ if (!uac2_control_is_writeable(mask, i))
ch_read_only |= (1 << j);
}
}
@@ -1198,9 +1198,9 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
/* FIXME: the whole unit is read-only if any of the channels is marked read-only */
if (ch_bits & 1) /* the first channel must be set (for ease of programming) */
build_feature_ctl(state, _ftr, ch_bits, i, &iterm, unitid, !!ch_read_only);
- if (master_bits & (1 << i * 2))
+ if (uac2_control_is_readable(master_bits, i))
build_feature_ctl(state, _ftr, 0, i, &iterm, unitid,
- ~master_bits & (1 << ((i * 2) + 1)));
+ !uac2_control_is_writeable(master_bits, i));
}
}