usb: host: xhci: return -ESHUTDOWN when removing hcd
PATCH 2/3 usb: host: xhci: return -ESHUTDOWN when removing hcd
Quoted 27 lines · Peter Chen
When we are removing HCD, the
xhci_configure_endpointmay be timeout. To get rid of timeout, we'd better return before issue command. The related log message when removing HCD like below:[66.736633] usb 3-1: USB disconnect, device number 2 [66.737003] hub 3-1:1.0: hub_ext_port_status failed (err = -71) [66.737054] usb 3-1.1: USB disconnect, device number 3 [66.759910] xhci-hcd xhci-hcd.1.auto: remove, state 4 [66.765043] usb usb4: USB disconnect, device number 1 [66.770169] usb 4-1: USB disconnect, device number 2 [74.008294] xhci-hcd xhci-hcd.1.auto: Timeout while waiting for configure endpoint command [74.018737] xhci-hcd xhci-hcd.1.auto: USB bus 4 deregistered [74.024446] xhci-hcd xhci-hcd.1.auto: remove, state 1 [74.029594] usb usb3: USB disconnect, device number 1 [74.062310] xhci-hcd xhci-hcd.1.auto: USB bus 3 deregisteredSigned-off-by Peter Chen <[email protected]>--- drivers/usb/host/xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/usb/host/xhci.c +0
-0
drivers/usb/host/xhci.c static int xhci_configure_endpoint(struct xhci_hcd *xhci, · line 2702
Quoted 6 lines
drivers/usb/host/xhci.c +2
-1@@ -2698,7 +2698,8 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,spin_lock_irqsave (&xhci->lock, flags); -if (xhci->xhc_state &XHCI_STATE_DYING ) { +if (xhci->xhc_state &XHCI_STATE_DYING || + xhci->xhc_state &XHCI_STATE_REMOVING ) {
Same comment as to the patch 3/3.
drivers/usb/host/xhci.c static int xhci_configure_endpoint(struct xhci_hcd *xhci, · line 2705
Quoted 3 lines
drivers/usb/host/xhci.c +0
-0spin_unlock_irqrestore (&xhci->lock, flags);return -ESHUTDOWN ; }
MBR, Sergei