[alsa-devel] [PATCH] fixed mixer range reading during probing when compiled with CONFIG_PM defined
Daniel Schürmann
daschuer at mixxx.org
Tue Apr 23 23:38:49 CEST 2013
During probing, snd_usb_autoresume() failes with -ENODEV. This brakes
get_ctl_value() in mixer.c when rading the range values. The new
code does not try to call snd_usb_autoresume() in this case.
The following snd_usb_suspend() fails silently during probing anyway.
The patch also makes the error messages more significant. The original
error messages where identified as missleading during debug.
Signed-off-by: Daniel Schürmann <daschuer at mixxx.org>
---
sound/usb/mixer.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index ca4739c..c2daa58 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -289,9 +289,11 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v
int timeout = 10;
int idx = 0, err;
- err = snd_usb_autoresume(cval->mixer->chip);
- if (err < 0)
- return -EIO;
+ if (!chip->probing) {
+ err = snd_usb_autoresume(cval->mixer->chip);
+ if (err < 0)
+ return -EIO;
+ }
down_read(&chip->shutdown_rwsem);
while (timeout-- > 0) {
if (chip->shutdown)
@@ -333,9 +335,14 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
memset(buf, 0, sizeof(buf));
- ret = snd_usb_autoresume(chip) ? -EIO : 0;
- if (ret)
- goto error;
+ if (!chip->probing) {
+ ret = snd_usb_autoresume(chip);
+ if (ret) {
+ snd_printk(KERN_ERR "snd_usb_autoresume() failed with %d\n", ret);
+ ret = -EIO;
+ goto error;
+ }
+ }
down_read(&chip->shutdown_rwsem);
if (chip->shutdown)
@@ -351,8 +358,8 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
if (ret < 0) {
error:
- snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
- request, validx, idx, cval->val_type);
+ snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, ret = %d\n",
+ bRequest, validx, idx, cval->val_type, ret);
return ret;
}
--
1.7.9.5
More information about the Alsa-devel
mailing list