linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* usb: do not reset if a low-speed device timed out
@ 2018-01-04 17:21 Maxim Moseychuk
  0 siblings, 0 replies; 3+ messages in thread
From: Maxim Moseychuk @ 2018-01-04 17:21 UTC (permalink / raw)
  To: Alan Stern; +Cc: linux-usb, gregkh, mathias.nyman

В Чт, 04/01/2018 в 11:57 -0500, Alan Stern пишет:
> On Thu, 4 Jan 2018, Maxim Moseychuk wrote:
> 
> > 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...
> 
> > Fixes: 264904ccc33c ("usb: retry reset if a device times out")
> > Signed-off-by: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmai
> l.com>
> > ---
> >  drivers/usb/core/hub.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> > index cf7bbcb9a63c..46366c73f0df 100644
> > --- a/drivers/usb/core/hub.c
> > +++ b/drivers/usb/core/hub.c
> > @@ -4524,7 +4524,10 @@ hub_port_init(struct usb_hub *hub, struct
> usb_device *udev, int port1,
> >                                * reset. But only on the first
> attempt,
> >                                * lest we get into a time out/reset
> loop
> >                                */
> > -                             if (r == 0  || (r == -ETIMEDOUT &&
> retries == 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.
> 
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread
* usb: do not reset if a low-speed device timed out
@ 2018-01-04 16:57 Alan Stern
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Stern @ 2018-01-04 16:57 UTC (permalink / raw)
  To: Maxim Moseychuk; +Cc: linux-usb, gregkh, mathias.nyman

On Thu, 4 Jan 2018, Maxim Moseychuk wrote:

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

> Fixes: 264904ccc33c ("usb: retry reset if a device times out")
> Signed-off-by: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com>
> ---
>  drivers/usb/core/hub.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index cf7bbcb9a63c..46366c73f0df 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -4524,7 +4524,10 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
>  				 * reset. But only on the first attempt,
>  				 * lest we get into a time out/reset loop
>  				 */
> -				if (r == 0  || (r == -ETIMEDOUT && retries == 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.

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
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread
* usb: do not reset if a low-speed device timed out
@ 2018-01-04  1:29 Maxim Moseychuk
  0 siblings, 0 replies; 3+ messages in thread
From: Maxim Moseychuk @ 2018-01-04  1:29 UTC (permalink / raw)
  To: linux-usb; +Cc: gregkh, stern, mathias.nyman, Maxim Moseychuk

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.

Fixes: 264904ccc33c ("usb: retry reset if a device times out")
Signed-off-by: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com>
---
 drivers/usb/core/hub.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index cf7bbcb9a63c..46366c73f0df 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4524,7 +4524,10 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
 				 * reset. But only on the first attempt,
 				 * lest we get into a time out/reset loop
 				 */
-				if (r == 0  || (r == -ETIMEDOUT && retries == 0))
+				if (r == 0 ||
+						r == -ETIMEDOUT
+						&& retries == 0
+						&& udev->speed > USB_SPEED_FULL)
 					break;
 			}
 			udev->descriptor.bMaxPacketSize0 =

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

end of thread, other threads:[~2018-01-04 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-04 17:21 usb: do not reset if a low-speed device timed out Maxim Moseychuk
  -- strict thread matches above, loose matches on Subject: below --
2018-01-04 16:57 Alan Stern
2018-01-04  1:29 Maxim Moseychuk

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