drivers/usb/misc/iowarrior.c : timeouts too small in usb_control_msg calls

Eberhard Fahle <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
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.

I added a patch for this, but I'm unable to test it against 2.6.21-rc5. I 
stumbled across this problem when doing a backport of the driver for Kernel 
2.6.20. (The patch works fine here)
------------------------------------------------
The patch also removes a useless debug statement, which was left over from 
testing a broken firmware version

Eberhard Fahle

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
iowarrior_timeouts.patch (text/x-diff, 1.5 KB)
--- linux-2.6.21-rc5/drivers/usb/misc/iowarrior.c	2007-03-26 00:56:23.000000000 +0200
+++ iowarrior.c	2007-04-04 15:22:10.000000000 +0200
@@ -118,7 +118,7 @@ static int usb_get_report(struct usb_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_int
 			       USB_TYPE_CLASS | USB_RECIP_INTERFACE,
 			       (type << 8) + id,
 			       intf->cur_altsetting->desc.bInterfaceNumber, buf,
-			       size, 1);
+			       size, HZ);
 }
 
 /*---------------------*/
@@ -748,8 +748,7 @@ static int iowarrior_probe(struct usb_in
 	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);
 	if (dev == NULL) {
@@ -824,11 +823,10 @@ static int iowarrior_probe(struct usb_in
 
 	/* 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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.