Skip to contentSkip to conversation

usb: do not reset if a low-speed device timed out

DISCUSSION Maxim Moseychuk 1 participant 1 message Jan 4, 2018 USB

lore
Share & tools
lore
#0 lore raw

В Чт, 04/01/2018 в 11:57 -0500, Alan Stern пишет:

Quoted 38 lines · Maxim Moseychuk
Quoted 6 lines

Some low-speed devices (for example, bluetooth) do not have time to initialize. For them, ETIMEDOUT is a valid error. We need to give them another try. Otherwise, they will never be initialized correctly and in dmesg will be messages "Bluetooth: hci0 command 0x1002 tx timeout" or similars.

Your patch description talks about low-speed devices...

Quoted 2 lines
Fixes 264904ccc33c ("usb: retry reset if a device times out")

l.com>

drivers/usb/core/hub.c hub_port_init(struct usb_hub *hub, struct

Quoted 9 lines
---
 drivers/usb/core/hub.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +0 -0
index cf7bbcb9a63c..46366c73f0df 100644
@@ -4524,7 +4524,10 @@ hub_port_init(struct usb_hub *hub, struct

usb_device *udev, int port1,

drivers/usb/core/hub.c hub_port_init(struct usb_hub *hub, struct · line 4524

Quoted 1 line
drivers/usb/core/hub.c +0 -0
                               * reset. But only on the first

attempt,

drivers/usb/core/hub.c hub_port_init(struct usb_hub *hub, struct · line 4525

Quoted 1 line
drivers/usb/core/hub.c +0 -0
                               * lest we get into a time out/reset

loop

drivers/usb/core/hub.c hub_port_init(struct usb_hub *hub, struct · line 4527

Quoted 2 lines
drivers/usb/core/hub.c +0 -1
                               */
-                             if (r == 0  || (r == -ETIMEDOUT &&

retries == 0))

drivers/usb/core/hub.c hub_port_init(struct usb_hub *hub, struct · line 4530

Quoted 4 lines
drivers/usb/core/hub.c +4 -0
+                             if (r == 0 ||
+                                             r == -ETIMEDOUT
+                                             && retries == 0
+                                             && udev->speed >

USB_SPEED_FULL)

but the patch itself affects both low-speed and full-speed devices.

Quoted 9 lines

Also, I would keep the parens around the && expressions, and there's no
need for the first line break you added. (For that matter, it looks strange to break the first line _after_ the || operator and then to break the later lines _before_ the && operators -- try to copy the style used elsewhere in that source file.)

Alan Stern

I probably chose the wrong term. We are talking about devices running at speeds of usb 1.1 (Low-speed and Full-speed).
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html