Re: [PATCH v2] sound: usb: mixer: increase control transfer timeout

Jassi Brar
2011-08-29T12:37:37Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 5261 bytes --]

On Mon, Aug 29, 2011 at 6:01 PM, Felipe Balbi <balbi@ti.com> wrote:
> 100ms might not be enough for slower devices. Increasing
> timeout to 1000ms doesn't seem like overkill.
>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> ---
>
> Changes since v1:
> Â . Increase all 100ms timeout to 1000ms
>
> Â sound/usb/mixer.c Â  Â  Â  Â | Â  Â 4 ++--
> Â sound/usb/mixer_quirks.c | Â  10 +++++-----
> Â 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> index cdd19d7..1c9d443 100644
> --- a/sound/usb/mixer.c
> +++ b/sound/usb/mixer.c
> @@ -296,7 +296,7 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v
> Â  Â  Â  Â  Â  Â  Â  Â if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),
> - Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  buf, val_len, 100) >= val_len) {
> + Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  buf, val_len, 1000) >= val_len) {
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len));
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â snd_usb_autosuspend(cval->mixer->chip);
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â return 0;
> @@ -445,7 +445,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â usb_sndctrlpipe(chip->dev, 0), request,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),
> - Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  buf, val_len, 100) >= 0) {
> + Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  buf, val_len, 1000) >= 0) {
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â snd_usb_autosuspend(chip);
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â return 0;
> Â  Â  Â  Â  Â  Â  Â  Â }
> diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
> index 3d0f487..7c41399 100644
> --- a/sound/usb/mixer_quirks.c
> +++ b/sound/usb/mixer_quirks.c
> @@ -190,18 +190,18 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
> Â  Â  Â  Â  Â  Â  Â  Â err = snd_usb_ctl_msg(mixer->chip->dev,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
> - Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  !value, 0, NULL, 0, 100);
> + Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  !value, 0, NULL, 0, 1000);
> Â  Â  Â  Â /* USB X-Fi S51 Pro */
> Â  Â  Â  Â if (mixer->chip->usb_id == USB_ID(0x041e, 0x30df))
> Â  Â  Â  Â  Â  Â  Â  Â err = snd_usb_ctl_msg(mixer->chip->dev,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
> - Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  !value, 0, NULL, 0, 100);
> + Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  !value, 0, NULL, 0, 1000);
> Â  Â  Â  Â else
> Â  Â  Â  Â  Â  Â  Â  Â err = snd_usb_ctl_msg(mixer->chip->dev,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
> - Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  value, index + 2, NULL, 0, 100);
> + Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  value, index + 2, NULL, 0, 1000);
> Â  Â  Â  Â if (err < 0)
> Â  Â  Â  Â  Â  Â  Â  Â return err;
> Â  Â  Â  Â mixer->audigy2nx_leds[index] = value;
> @@ -299,7 +299,7 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â usb_rcvctrlpipe(mixer->chip->dev, 0),
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS |
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â USB_RECIP_INTERFACE, 0,
> - Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  jacks[i].unitid << 8, buf, 3, 100);
> + Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  jacks[i].unitid << 8, buf, 3, 1000);
> Â  Â  Â  Â  Â  Â  Â  Â if (err == 3 && (buf[0] == 3 || buf[0] == 6))
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]);
> Â  Â  Â  Â  Â  Â  Â  Â else
> @@ -332,7 +332,7 @@ static int snd_xonar_u1_switch_put(struct snd_kcontrol *kcontrol,
> Â  Â  Â  Â err = snd_usb_ctl_msg(mixer->chip->dev,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â usb_sndctrlpipe(mixer->chip->dev, 0), 0x08,
> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
> - Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  50, 0, &new_status, 1, 100);
> + Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  50, 0, &new_status, 1, 1000);

How about also converting to use a local define for timeout value ?
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éÝ¶\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dÊ‡Ú™ë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥