blob: 4983dc996062dcea2d8bd9b685b54dcea5468a99 [file] [log] [blame]
Joel Stanleyb314cb52017-06-07 14:51:57 +09301From 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 Stanleyb314cb52017-06-07 14:51:57 +09304Subject: [PATCH 04/11] 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 Stanleyb314cb52017-06-07 14:51:57 +093017index f2e9f59c90d6..28fad2949308 100644
Joel Stanley2b0f7b42016-07-19 23:26:28 +093018--- a/drivers/usb/host/xhci.c
19+++ b/drivers/usb/host/xhci.c
20@@ -682,6 +682,21 @@ void xhci_stop(struct usb_hcd *hcd)
21
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
42@@ -693,11 +708,6 @@ void xhci_stop(struct usb_hcd *hcd)
43 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 Stanleyb314cb52017-06-07 14:51:57 +0930552.11.0
Joel Stanley2b0f7b42016-07-19 23:26:28 +093056