USB: fix control-message timeouts
Subsystems (3)
cover USB: fix control-message timeouts
A number of drivers throughout the tree were using timeout values in jiffies instead of milliseconds.
This series fixes a broken USB documentation example and the single driver in the USB subtree that got it wrong.
Johan
Johan Hovold (2):
Documentation: USB: fix example bulk-message timeout
USB: iowarrior: fix control-message timeouts
Documentation/driver-api/usb/writing_usb_driver.rst | 2 +- drivers/usb/misc/iowarrior.c | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-)
Signature · 1 line
2.32.0
PATCH 1/2 Documentation: USB: fix example bulk-message timeout
USB bulk-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
Use a fixed five-second timeout in the "Writing USB Device Drivers" example.
--- Documentation/driver-api/usb/writing_usb_driver.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/driver-api/usb/writing_usb_driver.rst +1 -1
@@ -231,7 +231,7 @@ error message. This can be shown with the following code:: skel->bulk_in_endpointAddr), skel->bulk_in_buffer, skel->bulk_in_size, - &count, HZ*10); + &count, 5000); /* if the read was successful, copy the data to user space */ if (!retval) { if (copy_to_user (buffer, skel->bulk_in_buffer, count))
Signature · 1 line
2.32.0
PATCH 2/2 USB: iowarrior: fix control-message timeouts
In reply to Johan HovoldUSB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
Use the common control-message timeout define for the five-second timeout and drop the driver-specific one.
--- drivers/usb/misc/iowarrior.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/usb/misc/iowarrior.c +2 -6
@@ -99,10 +99,6 @@ struct iowarrior {/* globals */ /*--------------*/ -/* -* USB spec identifies 5 second timeouts. -*/ -#define GET_TIMEOUT 5#define USB_REQ_GET_REPORT 0x01//#if 0 static int usb_get_report(struct usb_device *dev,
@@ -114,7 +110,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*HZ); + USB_CTRL_GET_TIMEOUT); }//#endif
@@ -129,7 +125,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, HZ); + size, 1000); }/*---------------------*/
Signature · 1 line
2.32.0