blob: 63ac296943ba3f53413bf5d1fd70322fa59d6c7c [file] [log] [blame]
Joel Stanleyd9669fe2016-01-22 16:13:06 +10301From 8afabdc0db0f80e45c9bfdeb3faadaa89d4dd775 Mon Sep 17 00:00:00 2001
2From: Joel Stanley <joel@jms.id.au>
3Date: Thu, 28 Jan 2016 13:07:06 +1030
4Subject: [PATCH 2/5] 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 3f912705dcef..2cc689a3b549 100644
21--- a/drivers/usb/host/xhci.c
22+++ b/drivers/usb/host/xhci.c
23@@ -665,6 +665,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@@ -679,14 +688,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--
612.7.0.rc3
62