blob: 63ac296943ba3f53413bf5d1fd70322fa59d6c7c [file] [log] [blame]
From 8afabdc0db0f80e45c9bfdeb3faadaa89d4dd775 Mon Sep 17 00:00:00 2001
From: Joel Stanley <joel@jms.id.au>
Date: Thu, 28 Jan 2016 13:07:06 +1030
Subject: [PATCH 2/5] Revert "usb: xhci: stop everything on the first call to
xhci_stop"
This reverts commit 8c24d6d7b09deee3036ddc4f2b81b53b28c8f877.
With this patch, the driver stops everything at the first call to
xhci_stop, which is always for the secondary HCD when executing the
.remove handler. We instead want to only stop when the primray HCD is
shutting down.
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
drivers/usb/host/xhci.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 3f912705dcef..2cc689a3b549 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -665,6 +665,15 @@ int xhci_run(struct usb_hcd *hcd)
}
EXPORT_SYMBOL_GPL(xhci_run);
+static void xhci_only_stop_hcd(struct usb_hcd *hcd)
+{
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+
+ spin_lock_irq(&xhci->lock);
+ xhci_halt(xhci);
+ spin_unlock_irq(&xhci->lock);
+}
+
/*
* Stop xHCI driver.
*
@@ -679,14 +688,15 @@ void xhci_stop(struct usb_hcd *hcd)
u32 temp;
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
- if (xhci->xhc_state & XHCI_STATE_HALTED)
+ mutex_lock(&xhci->mutex);
+
+ if (!usb_hcd_is_primary_hcd(hcd)) {
+ xhci_only_stop_hcd(xhci->shared_hcd);
+ mutex_unlock(&xhci->mutex);
return;
+ }
- mutex_lock(&xhci->mutex);
spin_lock_irq(&xhci->lock);
- xhci->xhc_state |= XHCI_STATE_HALTED;
- xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
-
/* Make sure the xHC is halted for a USB3 roothub
* (xhci_stop() could be called as part of failed init).
*/
--
2.7.0.rc3