blob: 1ed8cbe4de6fee3e10b742ad05ba63f04a21c394 [file] [log] [blame]
Joel Stanley8ac6ef02016-12-14 15:12:16 +10301From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
Joel Stanley2b0f7b42016-07-19 23:26:28 +09302From: Joel Stanley <joel@jms.id.au>
3Date: Tue, 19 Jul 2016 22:43:26 +0930
Joel Stanley41a7f1e2016-10-31 23:15:44 +10304Subject: [PATCH 3/4] xhci: do not halt the secondary HCD
Joel Stanley2b0f7b42016-07-19 23:26:28 +09305
6We can't halt the secondary HCD, because it's also the primary HCD,
7which will cause problems if we have devices attached to the primary
8HCD, like a keyboard.
9
10Sined-off-by: Joel Stanley <joel@jms.id.au>
11Signed-off-by: Joel Stanley <joel@jms.id.au>
12---
13 drivers/usb/host/xhci.c | 20 +++++++++++++++-----
14 1 file changed, 15 insertions(+), 5 deletions(-)
15
16diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
Joel Stanley21ff14e2017-01-30 15:32:04 +103017index 34e23c7d7797..4c6d135319c3 100644
Joel Stanley2b0f7b42016-07-19 23:26:28 +093018--- a/drivers/usb/host/xhci.c
19+++ b/drivers/usb/host/xhci.c
Joel Stanley41a7f1e2016-10-31 23:15:44 +103020@@ -683,6 +683,21 @@ void xhci_stop(struct usb_hcd *hcd)
Joel Stanley2b0f7b42016-07-19 23:26:28 +093021
22 mutex_lock(&xhci->mutex);
23
24+ /*
25+ * We can't halt the secondary HCD, because it's also the primary
26+ * HCD, which will cause problems if we have devices attached to the
27+ * primary HCD, like a keyboard.
28+ */
29+ if (!usb_hcd_is_primary_hcd(hcd)) {
30+ /* The shared_hcd is going to be deallocated shortly (the USB
31+ * core only calls this function when allocation fails in
32+ * usb_add_hcd(), or usb_remove_hcd() is called). So we need
33+ * to unset xHCI's pointer. */
34+ xhci->shared_hcd = NULL;
35+ mutex_unlock(&xhci->mutex);
36+ return;
37+ }
38+
39 if (!(xhci->xhc_state & XHCI_STATE_HALTED)) {
40 spin_lock_irq(&xhci->lock);
41
Joel Stanley41a7f1e2016-10-31 23:15:44 +103042@@ -694,11 +709,6 @@ void xhci_stop(struct usb_hcd *hcd)
Joel Stanley2b0f7b42016-07-19 23:26:28 +093043 spin_unlock_irq(&xhci->lock);
44 }
45
46- if (!usb_hcd_is_primary_hcd(hcd)) {
47- mutex_unlock(&xhci->mutex);
48- return;
49- }
50-
51 xhci_cleanup_msix(xhci);
52
53 /* Deleting Compliance Mode Recovery Timer */
54--
Joel Stanley8ac6ef02016-12-14 15:12:16 +1030552.11.0
Joel Stanley2b0f7b42016-07-19 23:26:28 +093056