summaryrefslogtreecommitdiffstats
path: root/sound/usb/mixer.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-06-15 12:24:05 +0200
committerTakashi Iwai <tiwai@suse.de>2010-06-15 12:24:05 +0200
commiteb6e70417bfef869324b8452f11ba7f300da4f81 (patch)
treeaaeeb53783f5fb16e8a0d1069104f8e7aed8e624 /sound/usb/mixer.c
parent8fda43c1a02baf093b63bca9770363642a7098e7 (diff)
parente8bdb6bbab60a8731f21823c86391f176d052348 (diff)
downloadop-kernel-dev-eb6e70417bfef869324b8452f11ba7f300da4f81.zip
op-kernel-dev-eb6e70417bfef869324b8452f11ba7f300da4f81.tar.gz
Merge branch 'fix/misc' into for-linus
Diffstat (limited to 'sound/usb/mixer.c')
-rw-r--r--sound/usb/mixer.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index a060d00..6939d0f5 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -297,20 +297,27 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v
static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)
{
- unsigned char buf[14]; /* enough space for one range of 4 bytes */
+ unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */
unsigned char *val;
- int ret;
+ int ret, size;
__u8 bRequest;
- bRequest = (request == UAC_GET_CUR) ?
- UAC2_CS_CUR : UAC2_CS_RANGE;
+ if (request == UAC_GET_CUR) {
+ bRequest = UAC2_CS_CUR;
+ size = sizeof(__u16);
+ } else {
+ bRequest = UAC2_CS_RANGE;
+ size = sizeof(buf);
+ }
+
+ memset(buf, 0, sizeof(buf));
ret = snd_usb_ctl_msg(cval->mixer->chip->dev,
usb_rcvctrlpipe(cval->mixer->chip->dev, 0),
bRequest,
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
validx, cval->mixer->ctrlif | (cval->id << 8),
- buf, sizeof(buf), 1000);
+ buf, size, 1000);
if (ret < 0) {
snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
@@ -318,6 +325,8 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
return ret;
}
+ /* FIXME: how should we handle multiple triplets here? */
+
switch (request) {
case UAC_GET_CUR:
val = buf;
OpenPOWER on IntegriCloud