blob: 1d0853dcc51759c735afd468abdf588a1aaa45dd [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 Stanley6a0ced92017-05-03 13:41:44 +09304Subject: [PATCH 2/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
Joel Stanley2b0f7b42016-07-19 23:26:28 +093010Signed-off-by: Joel Stanley <joel@jms.id.au>
11---
12 drivers/usb/host/xhci.c | 20 +++++++++++++++-----
13 1 file changed, 15 insertions(+), 5 deletions(-)
14
15diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
Joel Stanleyf85edaf2017-06-23 13:43:06 +093016index b1f779817ffe..662106a8dfc0 100644
Joel Stanley2b0f7b42016-07-19 23:26:28 +093017--- a/drivers/usb/host/xhci.c
18+++ b/drivers/usb/host/xhci.c
Joel Stanleye50183f2017-02-28 12:17:46 +103019@@ -689,6 +689,21 @@ void xhci_stop(struct usb_hcd *hcd)
Joel Stanley2b0f7b42016-07-19 23:26:28 +093020
21 mutex_lock(&xhci->mutex);
22
23+ /*
24+ * We can't halt the secondary HCD, because it's also the primary
25+ * HCD, which will cause problems if we have devices attached to the
26+ * primary HCD, like a keyboard.
27+ */
28+ if (!usb_hcd_is_primary_hcd(hcd)) {
29+ /* The shared_hcd is going to be deallocated shortly (the USB
30+ * core only calls this function when allocation fails in
31+ * usb_add_hcd(), or usb_remove_hcd() is called). So we need
32+ * to unset xHCI's pointer. */
33+ xhci->shared_hcd = NULL;
34+ mutex_unlock(&xhci->mutex);
35+ return;
36+ }
37+
38 if (!(xhci->xhc_state & XHCI_STATE_HALTED)) {
39 spin_lock_irq(&xhci->lock);
40
Joel Stanleye50183f2017-02-28 12:17:46 +103041@@ -699,11 +714,6 @@ void xhci_stop(struct usb_hcd *hcd)
Joel Stanley2b0f7b42016-07-19 23:26:28 +093042 spin_unlock_irq(&xhci->lock);
43 }
44
45- if (!usb_hcd_is_primary_hcd(hcd)) {
46- mutex_unlock(&xhci->mutex);
47- return;
48- }
49-
50 xhci_cleanup_msix(xhci);
51
52 /* Deleting Compliance Mode Recovery Timer */
53--
Joel Stanley8ac6ef02016-12-14 15:12:16 +1030542.11.0
Joel Stanley2b0f7b42016-07-19 23:26:28 +093055