blob: 0cfdd3902024894993edcc8fc265bbabc84fbfff [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>
Samuel Mendoza-Jonas7d8f5b92017-10-17 14:16:45 +110011Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Joel Stanley9db7e572017-12-18 09:50:40 +103012Signed-off-by: Joel Stanley <joel@jms.id.au>
Joel Stanley2b0f7b42016-07-19 23:26:28 +093013---
14 drivers/usb/host/xhci.c | 20 +++++++++++++++-----
15 1 file changed, 15 insertions(+), 5 deletions(-)
16
17diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
Joel Stanleyb314cb52017-06-07 14:51:57 +093018index f2e9f59c90d6..28fad2949308 100644
Joel Stanley2b0f7b42016-07-19 23:26:28 +093019--- a/drivers/usb/host/xhci.c
20+++ b/drivers/usb/host/xhci.c
21@@ -682,6 +682,21 @@ void xhci_stop(struct usb_hcd *hcd)
22
23 mutex_lock(&xhci->mutex);
24
25+ /*
26+ * We can't halt the secondary HCD, because it's also the primary
27+ * HCD, which will cause problems if we have devices attached to the
28+ * primary HCD, like a keyboard.
29+ */
30+ if (!usb_hcd_is_primary_hcd(hcd)) {
31+ /* The shared_hcd is going to be deallocated shortly (the USB
32+ * core only calls this function when allocation fails in
33+ * usb_add_hcd(), or usb_remove_hcd() is called). So we need
34+ * to unset xHCI's pointer. */
35+ xhci->shared_hcd = NULL;
36+ mutex_unlock(&xhci->mutex);
37+ return;
38+ }
39+
40 if (!(xhci->xhc_state & XHCI_STATE_HALTED)) {
41 spin_lock_irq(&xhci->lock);
42
43@@ -693,11 +708,6 @@ void xhci_stop(struct usb_hcd *hcd)
44 spin_unlock_irq(&xhci->lock);
45 }
46
47- if (!usb_hcd_is_primary_hcd(hcd)) {
48- mutex_unlock(&xhci->mutex);
49- return;
50- }
51-
52 xhci_cleanup_msix(xhci);
53
54 /* Deleting Compliance Mode Recovery Timer */