USB: iowarrior.c: timeouts too small in usb_control_msg calls
authorEberhard Fahle <e.fahle@wayoda.org>
Thu, 5 Apr 2007 09:13:21 +0000 (11:13 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 27 Apr 2007 20:28:43 +0000 (13:28 -0700)
The driver uses usb_control_msg() for exchanging data with the device.
When the driver lived freeley _outside_ the kernel tree (pre 2.6.21) the
timeouts for these calls where set to 5*HZ for reading, 1HZ for writing.
(These timeouts seemed to work fine for all users of the driver, at
least nobody complained in the last 2 years.

The current code (2.6.21-rc5) removed the 'HZ' from the timeouts and
left the driver with 5 jiffies for reading and 1 jiffy for writing. My
new machine is fast, but not that fast.

The patch also removes a useless debug statement, which was left over
from testing a broken firmware version

From: Eberhard Fahle <e.fahle@wayoda.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/misc/iowarrior.c

index de97ed7b0b95ed71ab614df4163fef5d391d39c8..fc51207b71b88b83654227151c1aa4c2147ad7b6 100644 (file)
@@ -118,7 +118,7 @@ static int usb_get_report(struct usb_device *dev,
                               USB_DIR_IN | USB_TYPE_CLASS |
                               USB_RECIP_INTERFACE, (type << 8) + id,
                               inter->desc.bInterfaceNumber, buf, size,
-                              GET_TIMEOUT);
+                              GET_TIMEOUT*HZ);
 }
 //#endif
 
@@ -133,7 +133,7 @@ static int usb_set_report(struct usb_interface *intf, unsigned char type,
                               USB_TYPE_CLASS | USB_RECIP_INTERFACE,
                               (type << 8) + id,
                               intf->cur_altsetting->desc.bInterfaceNumber, buf,
-                              size, 1);
+                              size, HZ);
 }
 
 /*---------------------*/
@@ -750,7 +750,6 @@ static int iowarrior_probe(struct usb_interface *interface,
        struct usb_endpoint_descriptor *endpoint;
        int i;
        int retval = -ENOMEM;
-       int idele = 0;
 
        /* allocate memory for our device state and intialize it */
        dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL);
@@ -826,11 +825,10 @@ static int iowarrior_probe(struct usb_interface *interface,
 
        /* Set the idle timeout to 0, if this is interface 0 */
        if (dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) {
-               idele = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
-                                       0x0A,
-                                       USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0,
-                                       0, NULL, 0, USB_CTRL_SET_TIMEOUT);
-               dbg("idele = %d", idele);
+           usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+                           0x0A,
+                           USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0,
+                           0, NULL, 0, USB_CTRL_SET_TIMEOUT);
        }
        /* allow device read and ioctl */
        dev->present = 1;