blob: 5c104361ec634671985777380ef9d9c2f40acdcb [file] [log] [blame]
Joel Stanley12779292016-06-25 23:13:56 +09301From 2481d9f7a822f3e5273c9bd4e273685eeb939b26 Mon Sep 17 00:00:00 2001
Joel Stanley34fa5c62016-05-11 13:35:01 +09302From: Joel Stanley <joel@jms.id.au>
3Date: Thu, 28 Jan 2016 13:07:06 +1030
4Subject: [PATCH 2/7] Revert "usb: xhci: stop everything on the first call to
5 xhci_stop"
6
7This reverts commit 8c24d6d7b09deee3036ddc4f2b81b53b28c8f877.
8
9With this patch, the driver stops everything at the first call to
10xhci_stop, which is always for the secondary HCD when executing the
11.remove handler. We instead want to only stop when the primray HCD is
12shutting down.
13
14Signed-off-by: Joel Stanley <joel@jms.id.au>
15---
16 drivers/usb/host/xhci.c | 20 +++++++++++++++-----
17 1 file changed, 15 insertions(+), 5 deletions(-)
18
19diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
20index ec9e758d5fcd..0e66476d4866 100644
21--- a/drivers/usb/host/xhci.c
22+++ b/drivers/usb/host/xhci.c
23@@ -666,6 +666,15 @@ int xhci_run(struct usb_hcd *hcd)
24 }
25 EXPORT_SYMBOL_GPL(xhci_run);
26
27+static void xhci_only_stop_hcd(struct usb_hcd *hcd)
28+{
29+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
30+
31+ spin_lock_irq(&xhci->lock);
32+ xhci_halt(xhci);
33+ spin_unlock_irq(&xhci->lock);
34+}
35+
36 /*
37 * Stop xHCI driver.
38 *
39@@ -680,14 +689,15 @@ void xhci_stop(struct usb_hcd *hcd)
40 u32 temp;
41 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
42
43- if (xhci->xhc_state & XHCI_STATE_HALTED)
44+ mutex_lock(&xhci->mutex);
45+
46+ if (!usb_hcd_is_primary_hcd(hcd)) {
47+ xhci_only_stop_hcd(xhci->shared_hcd);
48+ mutex_unlock(&xhci->mutex);
49 return;
50+ }
51
52- mutex_lock(&xhci->mutex);
53 spin_lock_irq(&xhci->lock);
54- xhci->xhc_state |= XHCI_STATE_HALTED;
55- xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
56-
57 /* Make sure the xHC is halted for a USB3 roothub
58 * (xhci_stop() could be called as part of failed init).
59 */
60--
Joel Stanley12779292016-06-25 23:13:56 +0930612.8.1
Joel Stanley34fa5c62016-05-11 13:35:01 +093062