[PATCH 3/3] usb: host: xhci: return early for xhci_urb_dequeue when removing hcd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When we are removing hcd, the stop endpoint command may be timeout.
To eliminate the timeout, we'd better return early. The related log
for this timeout like below:

[31.208933] hub 3-1:1.0: hub_ext_port_status failed (err = -71)
[31.214972] usb 3-1-port2: cannot reset (err = -71)
[31.219962] usb 3-1-port2: cannot reset (err = -71)
[31.225069] usb 3-1-port2: cannot reset (err = -71)
[31.230018] usb 3-1-port2: Cannot enable. Maybe the USB cable is bad?
[31.236566] usb 3-1-port2: cannot disable (err = -71)
[31.241745] usb 3-1-port2: unable to enumerate USB device
[31.247255] usb 3-1-port2: cannot disable (err = -71)
[31.252422] hub 3-1:1.0: hub_ext_port_status failed (err = -71)
[31.258486] hub 3-1:1.0: hub_ext_port_status failed (err = -71)
[31.264518] hub 3-1:1.0: hub_ext_port_status failed (err = -71)
[31.270649] hub 3-1:1.0: hub_ext_port_status failed (err = -71)
[31.276723] hub 3-1:1.0: hub_ext_port_status failed (err = -71)
[31.282809] usb 3-1: USB disconnect, device number 2
[31.287859] usb 3-1.1: USB disconnect, device number 3
[31.293076] usb 3-1.1: unregistering device
[31.299292] xhci-hcd xhci-hcd.1.auto: remove, state 4
[31.304416] usb usb4: USB disconnect, device number 1
[31.309566] usb 4-1: USB disconnect, device number 2
[31.314589] usb 4-1: unregistering device
[31.316389] usb 3-1: unregistering device
[31.331131] usb usb4: unregistering device
[31.339809] xhci-hcd xhci-hcd.1.auto: USB bus 4 deregistered
[31.345534] xhci-hcd xhci-hcd.1.auto: remove, state 1
[31.350668] usb usb3: USB disconnect, device number 1
[36.407457] xhci-hcd xhci-hcd.1.auto: xHCI host not responding to stop endpoint command.
[36.423638] xhci-hcd xhci-hcd.1.auto: xHCI host controller not responding, assume dead
[36.436502] usb usb3: unregistering device
[36.445429] xhci-hcd xhci-hcd.1.auto: USB bus 3 deregistered

Signed-off-by: Peter Chen <peter.chen@xxxxxxx>
---
 drivers/usb/host/xhci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 3113938063fd..1bcf27a9737d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1601,7 +1601,8 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
 		goto err_giveback;
 	}
 
-	if (xhci->xhc_state & XHCI_STATE_HALTED) {
+	if (xhci->xhc_state & XHCI_STATE_HALTED ||
+		xhci->xhc_state & XHCI_STATE_REMOVING) {
 		xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
 				"HC halted, freeing TD manually.");
 		for (i = urb_priv->num_tds_done;
-- 
2.14.1




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux