All of lore.kernel.org
 help / color / mirror / Atom feed
* [2/3] usb: host: xhci: return -ESHUTDOWN when removing hcd
@ 2018-09-21  9:03 Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2018-09-21  9:03 UTC (permalink / raw)
  To: Peter Chen, mathias.nyman; +Cc: linux-usb, linux-imx, jun.li

On 9/21/2018 4:48 AM, Peter Chen wrote:

> When we are removing HCD, the xhci_configure_endpoint may 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 deregistered
> 
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> ---
>   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 0420eefa647a..3113938063fd 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -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.

>   		spin_unlock_irqrestore(&xhci->lock, flags);
>   		return -ESHUTDOWN;
>   	}

MBR, Sergei

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

* [2/3] usb: host: xhci: return -ESHUTDOWN when removing hcd
@ 2018-09-21  1:48 Peter Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Chen @ 2018-09-21  1:48 UTC (permalink / raw)
  To: mathias.nyman; +Cc: linux-usb, linux-imx, jun.li, Peter Chen

When we are removing HCD, the xhci_configure_endpoint may 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 deregistered

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 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 0420eefa647a..3113938063fd 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -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) {
 		spin_unlock_irqrestore(&xhci->lock, flags);
 		return -ESHUTDOWN;
 	}

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

end of thread, other threads:[~2018-09-21  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-21  9:03 [2/3] usb: host: xhci: return -ESHUTDOWN when removing hcd Sergei Shtylyov
  -- strict thread matches above, loose matches on Subject: below --
2018-09-21  1:48 Peter Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.