stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: retry reset if a device times out
@ 2016-02-03 10:47 Oliver Neukum
  2016-02-03 16:24 ` Alan Stern
  0 siblings, 1 reply; 12+ messages in thread
From: Oliver Neukum @ 2016-02-03 10:47 UTC (permalink / raw)
  To: gregkh, stern, linux-usb; +Cc: Oliver Neukum, stable

Some devices I got show an inability to operate right after
power on if they are already connected. They are beyond recovery
if the descriptors are requested multiple times. So in case of
a timeout we rather bail early and reset again.

This patch is a rework of a patch that fell through the cracks.
http://www.spinics.net/lists/linux-usb/msg103263.html

Signed-off-by: Oliver Neukum <oneukum@suse.com>
CC: stable@vger.kernel.org
---
 drivers/usb/core/hub.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f912fe6..2124c4e 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4496,7 +4496,12 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
 						r = -EPROTO;
 					break;
 				}
-				if (r == 0)
+				/*
+				 * Some devices time out if they are powered on
+				 * when already connected. They need a second
+				 * reset.
+				 */
+				if (r == 0  || r == -ETIMEDOUT)
 					break;
 			}
 			udev->descriptor.bMaxPacketSize0 =
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [PATCH] usb: retry reset if a device times out
@ 2016-02-10 10:33 Oliver Neukum
  2016-02-17  3:38 ` Peter Chen
  0 siblings, 1 reply; 12+ messages in thread
From: Oliver Neukum @ 2016-02-10 10:33 UTC (permalink / raw)
  To: linux-usb, gregkh, stern, hzpeterchen; +Cc: Oliver Neukum, stable

Some devices I got show an inability to operate right after
power on if they are already connected. They are beyond recovery
if the descriptors are requested multiple times. So in case of
a timeout we rather bail early and reset again. But it must be
done only on the first loop lest we get into a reset/time out
spiral that can be overcome with a retry.

This patch is a rework of a patch that fell through the cracks.
http://www.spinics.net/lists/linux-usb/msg103263.html

Signed-off-by: Oliver Neukum <oneukum@suse.com>
CC: stable@vger.kernel.org
---
 drivers/usb/core/hub.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f912fe6..e4e46f6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4496,7 +4496,13 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
 						r = -EPROTO;
 					break;
 				}
-				if (r == 0)
+				/*
+				 * Some devices time out if they are powered on
+				 * when already connected. They need a second
+				 * reset. But only on the first attempt,
+				 * lest we get into a time out/reset loop
+				 */
+				if (r == 0  || (r == -ETIMEDOUT && j == 0))
 					break;
 			}
 			udev->descriptor.bMaxPacketSize0 =
-- 
2.1.4


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

end of thread, other threads:[~2016-02-17  9:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-03 10:47 [PATCH] usb: retry reset if a device times out Oliver Neukum
2016-02-03 16:24 ` Alan Stern
2016-02-03 20:52   ` Oliver Neukum
2016-02-04  6:53   ` Peter Chen
2016-02-04  8:53     ` Oliver Neukum
2016-02-04  9:08       ` Peter Chen
2016-02-04  9:30         ` Oliver Neukum
2016-02-04 15:41           ` Alan Stern
2016-02-05  2:16             ` Peter Chen
  -- strict thread matches above, loose matches on Subject: below --
2016-02-10 10:33 Oliver Neukum
2016-02-17  3:38 ` Peter Chen
2016-02-17  9:15   ` Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).