linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: musb: return -ESHUTDOWN in urb when three-strikes error happened
@ 2020-05-13 21:36 Bin Liu
  2020-05-14  1:32 ` Alan Stern
  0 siblings, 1 reply; 17+ messages in thread
From: Bin Liu @ 2020-05-13 21:36 UTC (permalink / raw)
  To: linux-usb; +Cc: Bin Liu

When a USB device attached to a hub got disconnected, MUSB controller
generates RXCSR_RX_ERROR interrupt for the 3-strikes-out error.

Currently the MUSB host driver returns -EPROTO in current URB, then the
USB device driver could immediately resubmit the URB which causes MUSB
generate RXCSR_RX_ERROR interrupt again. This circle causes interrupt
storm then the hub never got a chance to report the USB device detach.

To fix the interrupt storm, change the URB return code to -ESHUTDOWN for
MUSB_RXCSR_H_ERROR interrupt, so that the USB device driver will not
immediately resubmit the URB.

Signed-off-by: Bin Liu <b-liu@ti.com>
---
 drivers/usb/musb/musb_host.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 8736f4251a22..e41d910dcad1 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -1774,9 +1774,9 @@ void musb_host_rx(struct musb *musb, u8 epnum)
 		status = -EPIPE;
 
 	} else if (rx_csr & MUSB_RXCSR_H_ERROR) {
-		musb_dbg(musb, "end %d RX proto error", epnum);
+		dev_err(musb->controller, "ep%d RX three-strikes error", epnum);
 
-		status = -EPROTO;
+		status = -ESHUTDOWN;
 		musb_writeb(epio, MUSB_RXINTERVAL, 0);
 
 		rx_csr &= ~MUSB_RXCSR_H_ERROR;
-- 
2.17.1


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

end of thread, other threads:[~2020-05-20 18:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 21:36 [PATCH] usb: musb: return -ESHUTDOWN in urb when three-strikes error happened Bin Liu
2020-05-14  1:32 ` Alan Stern
2020-05-14 14:28   ` Bin Liu
2020-05-14 14:40     ` Alan Stern
2020-05-14 15:02       ` Bin Liu
2020-05-14 15:37         ` Bin Liu
2020-05-14 16:26           ` Alan Stern
2020-05-14 17:00             ` Bin Liu
2020-05-14 18:55               ` Alan Stern
2020-05-19 17:12                 ` Bin Liu
2020-05-19 20:01                   ` Alan Stern
2020-05-20 14:31                     ` Bin Liu
2020-05-20 16:40                       ` Alan Stern
2020-05-20 18:05                         ` Bin Liu
2020-05-20 18:25                           ` Alan Stern
2020-05-20 18:59                             ` Bin Liu
2020-05-19 17:28             ` [PATCH v2] " Bin Liu

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