All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] USB: fix control-message timeouts
@ 2021-10-25 11:51 Johan Hovold
  2021-10-25 11:51 ` [PATCH 1/2] Documentation: USB: fix example bulk-message timeout Johan Hovold
  2021-10-25 11:51 ` [PATCH 2/2] USB: iowarrior: fix control-message timeouts Johan Hovold
  0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2021-10-25 11:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jonathan Corbet, linux-doc, linux-usb, linux-kernel, Johan Hovold

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(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] Documentation: USB: fix example bulk-message timeout
  2021-10-25 11:51 [PATCH 0/2] USB: fix control-message timeouts Johan Hovold
@ 2021-10-25 11:51 ` Johan Hovold
  2021-10-25 11:51 ` [PATCH 2/2] USB: iowarrior: fix control-message timeouts Johan Hovold
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2021-10-25 11:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jonathan Corbet, linux-doc, linux-usb, linux-kernel, Johan Hovold

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.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 Documentation/driver-api/usb/writing_usb_driver.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/driver-api/usb/writing_usb_driver.rst b/Documentation/driver-api/usb/writing_usb_driver.rst
index 2176297e5765..4356f023065b 100644
--- a/Documentation/driver-api/usb/writing_usb_driver.rst
+++ b/Documentation/driver-api/usb/writing_usb_driver.rst
@@ -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))
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] USB: iowarrior: fix control-message timeouts
  2021-10-25 11:51 [PATCH 0/2] USB: fix control-message timeouts Johan Hovold
  2021-10-25 11:51 ` [PATCH 1/2] Documentation: USB: fix example bulk-message timeout Johan Hovold
@ 2021-10-25 11:51 ` Johan Hovold
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2021-10-25 11:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jonathan Corbet, linux-doc, linux-usb, linux-kernel, Johan Hovold,
	stable

USB 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.

Fixes: 946b960d13c1 ("USB: add driver for iowarrior devices.")
Cc: stable@vger.kernel.org      # 2.6.21
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/misc/iowarrior.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index efbd317f2f25..988a8c02e7e2 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -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);
 }
 
 /*---------------------*/
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-25 11:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-25 11:51 [PATCH 0/2] USB: fix control-message timeouts Johan Hovold
2021-10-25 11:51 ` [PATCH 1/2] Documentation: USB: fix example bulk-message timeout Johan Hovold
2021-10-25 11:51 ` [PATCH 2/2] USB: iowarrior: fix control-message timeouts Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.