ChangeSet 1.2020.1.56, 2005/03/08 00:03:49-08:00, [EMAIL PROTECTED]

[PATCH] usb/audio: change parameters of usb_{control,bulk}_msg() to msecs

Change units of parameters being passed to usb_{control,bulk}_msg() to
milliseconds. Patch is compile-tested.

Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


 drivers/usb/class/audio.c |   56 +++++++++++++++++++++++-----------------------
 1 files changed, 28 insertions(+), 28 deletions(-)


diff -Nru a/drivers/usb/class/audio.c b/drivers/usb/class/audio.c
--- a/drivers/usb/class/audio.c 2005-03-08 16:50:34 -08:00
+++ b/drivers/usb/class/audio.c 2005-03-08 16:50:34 -08:00
@@ -1561,7 +1561,7 @@
        if (fmt->attributes & 0x02) {
                data[0] = 1;
                if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 
SET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 
-                                          PITCH_CONTROL << 8, ep, data, 1, 
HZ)) < 0) {
+                                          PITCH_CONTROL << 8, ep, data, 1, 
1000)) < 0) {
                        printk(KERN_ERR "usbaudio: failure (error %d) to set 
output pitch control device %d interface %u endpoint 0x%x to %u\n",
                               ret, dev->devnum, u->interface, ep, d->srate);
                        return -1;
@@ -1573,13 +1573,13 @@
                data[1] = d->srate >> 8;
                data[2] = d->srate >> 16;
                if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 
SET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 
-                                          SAMPLING_FREQ_CONTROL << 8, ep, 
data, 3, HZ)) < 0) {
+                                          SAMPLING_FREQ_CONTROL << 8, ep, 
data, 3, 1000)) < 0) {
                        printk(KERN_ERR "usbaudio: failure (error %d) to set 
input sampling frequency device %d interface %u endpoint 0x%x to %u\n",
                               ret, dev->devnum, u->interface, ep, d->srate);
                        return -1;
                }
                if ((ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 
GET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_IN,
-                                          SAMPLING_FREQ_CONTROL << 8, ep, 
data, 3, HZ)) < 0) {
+                                          SAMPLING_FREQ_CONTROL << 8, ep, 
data, 3, 1000)) < 0) {
                        printk(KERN_ERR "usbaudio: failure (error %d) to get 
input sampling frequency device %d interface %u endpoint 0x%x\n",
                               ret, dev->devnum, u->interface, ep);
                        return -1;
@@ -1657,7 +1657,7 @@
        if (fmt->attributes & 0x02) {
                data[0] = 1;
                if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 
SET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 
-                                          PITCH_CONTROL << 8, ep, data, 1, 
HZ)) < 0) {
+                                          PITCH_CONTROL << 8, ep, data, 1, 
1000)) < 0) {
                        printk(KERN_ERR "usbaudio: failure (error %d) to set 
output pitch control device %d interface %u endpoint 0x%x to %u\n",
                               ret, dev->devnum, u->interface, ep, d->srate);
                        return -1;
@@ -1669,13 +1669,13 @@
                data[1] = d->srate >> 8;
                data[2] = d->srate >> 16;
                if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 
SET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 
-                                          SAMPLING_FREQ_CONTROL << 8, ep, 
data, 3, HZ)) < 0) {
+                                          SAMPLING_FREQ_CONTROL << 8, ep, 
data, 3, 1000)) < 0) {
                        printk(KERN_ERR "usbaudio: failure (error %d) to set 
output sampling frequency device %d interface %u endpoint 0x%x to %u\n",
                               ret, dev->devnum, u->interface, ep, d->srate);
                        return -1;
                }
                if ((ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 
GET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_IN,
-                                          SAMPLING_FREQ_CONTROL << 8, ep, 
data, 3, HZ)) < 0) {
+                                          SAMPLING_FREQ_CONTROL << 8, ep, 
data, 3, 1000)) < 0) {
                        printk(KERN_ERR "usbaudio: failure (error %d) to get 
output sampling frequency device %d interface %u endpoint 0x%x\n",
                               ret, dev->devnum, u->interface, ep);
                        return -1;
@@ -1754,7 +1754,7 @@
                data[0] = v1;
                data[1] = v1 >> 8;
                if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-                                   (ch->chnum << 8) | 1, ms->iface | 
(ch->unitid << 8), data, 2, HZ) < 0)
+                                   (ch->chnum << 8) | 1, ms->iface | 
(ch->unitid << 8), data, 2, 1000) < 0)
                        goto err;
                if (!(ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT)))
                        return 0;
@@ -1762,7 +1762,7 @@
                data[1] = v2 >> 8;
                if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
                                    ((ch->chnum + !!(ch->flags & 
MIXFLG_STEREOIN)) << 8) | (1 + !!(ch->flags & MIXFLG_STEREOOUT)),
-                                   ms->iface | (ch->unitid << 8), data, 2, HZ) 
< 0)
+                                   ms->iface | (ch->unitid << 8), data, 2, 
1000) < 0)
                        goto err;
                return 0;
 
@@ -1771,14 +1771,14 @@
                data[0] = v1;
                data[1] = v1 >> 8;
                if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-                                   (ch->selector << 8) | ch->chnum, ms->iface 
| (ch->unitid << 8), data, 2, HZ) < 0)
+                                   (ch->selector << 8) | ch->chnum, ms->iface 
| (ch->unitid << 8), data, 2, 1000) < 0)
                        goto err;
                if (!(ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT)))
                        return 0;
                data[0] = v2;
                data[1] = v2 >> 8;
                if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-                                   (ch->selector << 8) | (ch->chnum + 1), 
ms->iface | (ch->unitid << 8), data, 2, HZ) < 0)
+                                   (ch->selector << 8) | (ch->chnum + 1), 
ms->iface | (ch->unitid << 8), data, 2, 1000) < 0)
                        goto err;
                return 0;
                 
@@ -1787,13 +1787,13 @@
        case TREBLE_CONTROL:
                data[0] = v1 >> 8;
                if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-                                   (ch->selector << 8) | ch->chnum, ms->iface 
| (ch->unitid << 8), data, 1, HZ) < 0)
+                                   (ch->selector << 8) | ch->chnum, ms->iface 
| (ch->unitid << 8), data, 1, 1000) < 0)
                        goto err;
                if (!(ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT)))
                        return 0;
                data[0] = v2 >> 8;
                if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-                                   (ch->selector << 8) | (ch->chnum + 1), 
ms->iface | (ch->unitid << 8), data, 1, HZ) < 0)
+                                   (ch->selector << 8) | (ch->chnum + 1), 
ms->iface | (ch->unitid << 8), data, 1, 1000) < 0)
                        goto err;
                return 0;
 
@@ -1820,7 +1820,7 @@
                if (!ms->ch[i].slctunitid || (mask & (1 << i)))
                        continue;
                if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   0, ms->iface | (ms->ch[i].slctunitid << 8), 
&buf, 1, HZ) < 0) {
+                                   0, ms->iface | (ms->ch[i].slctunitid << 8), 
&buf, 1, 1000) < 0) {
                        err = -EIO;
                        printk(KERN_ERR "usbaudio: selector read request device 
%u if %u unit %u failed\n", 
                               dev->devnum, ms->iface, ms->ch[i].slctunitid & 
0xff);
@@ -1851,7 +1851,7 @@
                if (!ms->ch[i].slctunitid || (mask & (1 << i)))
                        continue;
                if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   0, ms->iface | (ms->ch[i].slctunitid << 8), 
&buf, 1, HZ) < 0) {
+                                   0, ms->iface | (ms->ch[i].slctunitid << 8), 
&buf, 1, 1000) < 0) {
                        err = -EIO;
                        printk(KERN_ERR "usbaudio: selector read request device 
%u if %u unit %u failed\n", 
                               dev->devnum, ms->iface, ms->ch[i].slctunitid & 
0xff);
@@ -1880,7 +1880,7 @@
                                continue;
                        buf = ms->ch[j].slctunitid >> 8;
                        if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 
SET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-                                   0, ms->iface | (ms->ch[j].slctunitid << 8), 
&buf, 1, HZ) < 0) {
+                                   0, ms->iface | (ms->ch[j].slctunitid << 8), 
&buf, 1, 1000) < 0) {
                                err = -EIO;
                                printk(KERN_ERR "usbaudio: selector write 
request device %u if %u unit %u failed\n", 
                                       dev->devnum, ms->iface, 
ms->ch[j].slctunitid & 0xff);
@@ -3136,18 +3136,18 @@
        switch (ch->selector) {
        case 0:  /* mixer unit request */
                if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MIN, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   (ch->chnum << 8) | 1, state->ctrlif | 
(ch->unitid << 8), buf, 2, HZ) < 0)
+                                   (ch->chnum << 8) | 1, state->ctrlif | 
(ch->unitid << 8), buf, 2, 1000) < 0)
                        goto err;
                ch->minval = buf[0] | (buf[1] << 8);
                if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MAX, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   (ch->chnum << 8) | 1, state->ctrlif | 
(ch->unitid << 8), buf, 2, HZ) < 0)
+                                   (ch->chnum << 8) | 1, state->ctrlif | 
(ch->unitid << 8), buf, 2, 1000) < 0)
                        goto err;
                ch->maxval = buf[0] | (buf[1] << 8);
                v2 = ch->maxval - ch->minval;
                if (!v2)
                        v2 = 1;
                if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   (ch->chnum << 8) | 1, state->ctrlif | 
(ch->unitid << 8), buf, 2, HZ) < 0)
+                                   (ch->chnum << 8) | 1, state->ctrlif | 
(ch->unitid << 8), buf, 2, 1000) < 0)
                        goto err;
                v1 = buf[0] | (buf[1] << 8);
                v3 = v1 - ch->minval;
@@ -3158,7 +3158,7 @@
                if (ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT)) {
                        if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 
GET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
                                            ((ch->chnum + !!(ch->flags & 
MIXFLG_STEREOIN)) << 8) | (1 + !!(ch->flags & MIXFLG_STEREOOUT)),
-                                           state->ctrlif | (ch->unitid << 8), 
buf, 2, HZ) < 0)
+                                           state->ctrlif | (ch->unitid << 8), 
buf, 2, 1000) < 0)
                        goto err;
                        v1 = buf[0] | (buf[1] << 8);
                        v3 = v1 - ch->minval;
@@ -3172,15 +3172,15 @@
                /* various feature unit controls */
        case VOLUME_CONTROL:
                if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MIN, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)
+                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)
                        goto err;
                ch->minval = buf[0] | (buf[1] << 8);
                if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MAX, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)
+                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)
                        goto err;
                ch->maxval = buf[0] | (buf[1] << 8);
                if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)
+                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)
                        goto err;
                v1 = buf[0] | (buf[1] << 8);
                v2 = ch->maxval - ch->minval;
@@ -3193,7 +3193,7 @@
                ch->value = v3;
                if (ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT)) {
                        if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 
GET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                           (ch->selector << 8) | (ch->chnum + 
1), state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)
+                                           (ch->selector << 8) | (ch->chnum + 
1), state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)
                                goto err;
                        v1 = buf[0] | (buf[1] << 8);
                        v3 = v1 - ch->minval;
@@ -3208,15 +3208,15 @@
        case MID_CONTROL:
        case TREBLE_CONTROL:
                if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MIN, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 1, HZ) < 0)
+                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 1, 1000) < 0)
                        goto err;
                ch->minval = buf[0] << 8;
                if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MAX, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 1, HZ) < 0)
+                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 1, 1000) < 0)
                        goto err;
                ch->maxval = buf[0] << 8;
                if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 1, HZ) < 0)
+                                   (ch->selector << 8) | ch->chnum, 
state->ctrlif | (ch->unitid << 8), buf, 1, 1000) < 0)
                        goto err;
                v1 = buf[0] << 8;
                v2 = ch->maxval - ch->minval;
@@ -3229,7 +3229,7 @@
                ch->value = v3;
                if (ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT)) {
                        if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 
GET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-                                           (ch->selector << 8) | (ch->chnum + 
1), state->ctrlif | (ch->unitid << 8), buf, 1, HZ) < 0)
+                                           (ch->selector << 8) | (ch->chnum + 
1), state->ctrlif | (ch->unitid << 8), buf, 1, 1000) < 0)
                                goto err;
                        v1 = buf[0] << 8;
                        v3 = v1 - ch->minval;
@@ -3522,7 +3522,7 @@
                printk(KERN_DEBUG "usbaudio: unmuting feature unit %u interface 
%u\n", ftr[3], state->ctrlif);
                data[0] = 0;
                if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, 
USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-                                   (MUTE_CONTROL << 8) | 0xff, state->ctrlif | 
(ftr[3] << 8), data, 1, HZ) < 0)
+                                   (MUTE_CONTROL << 8) | 0xff, state->ctrlif | 
(ftr[3] << 8), data, 1, 1000) < 0)
                        printk(KERN_WARNING "usbaudio: failure to unmute 
feature unit %u interface %u\n", ftr[3], state->ctrlif);
        }
 #endif



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to