Skip to content

Commit 8c24d6d

Browse files
Roger Quadrosgregkh
Roger Quadros
authored andcommitted
usb: xhci: stop everything on the first call to xhci_stop
xhci_stop will be called twice, once for the shared hcd and again for the primary hcd. We stop the XHCI controller in any case so clean up everything on the first call else we can timeout waiting for pending requests to complete. Cc: <[email protected]> Signed-off-by: Roger Quadros <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e5bfeab commit 8c24d6d

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

drivers/usb/host/xhci.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -655,15 +655,6 @@ int xhci_run(struct usb_hcd *hcd)
655655
}
656656
EXPORT_SYMBOL_GPL(xhci_run);
657657

658-
static void xhci_only_stop_hcd(struct usb_hcd *hcd)
659-
{
660-
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
661-
662-
spin_lock_irq(&xhci->lock);
663-
xhci_halt(xhci);
664-
spin_unlock_irq(&xhci->lock);
665-
}
666-
667658
/*
668659
* Stop xHCI driver.
669660
*
@@ -678,15 +669,14 @@ void xhci_stop(struct usb_hcd *hcd)
678669
u32 temp;
679670
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
680671

681-
mutex_lock(&xhci->mutex);
682-
683-
if (!usb_hcd_is_primary_hcd(hcd)) {
684-
xhci_only_stop_hcd(xhci->shared_hcd);
685-
mutex_unlock(&xhci->mutex);
672+
if (xhci->xhc_state & XHCI_STATE_HALTED)
686673
return;
687-
}
688674

675+
mutex_lock(&xhci->mutex);
689676
spin_lock_irq(&xhci->lock);
677+
xhci->xhc_state |= XHCI_STATE_HALTED;
678+
xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
679+
690680
/* Make sure the xHC is halted for a USB3 roothub
691681
* (xhci_stop() could be called as part of failed init).
692682
*/

0 commit comments

Comments
 (0)