blob: b6760c9326d9b4a70c5a050013a6444429c2f7df [file] [log] [blame]
Klaus Heinrich Kiwi49aaa422020-06-24 08:10:42 -05001From de6c0cd214bbf94627c302db2c8101542f9b9e52 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
Klaus Heinrich Kiwi49aaa422020-06-24 08:10:42 -05004Subject: [PATCH 04/10] 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
Klaus Heinrich Kiwi49aaa422020-06-24 08:10:42 -050018index af4e681..af702ba 100644
Joel Stanley2b0f7b42016-07-19 23:26:28 +093019--- a/drivers/usb/host/xhci.c
20+++ b/drivers/usb/host/xhci.c
Klaus Heinrich Kiwi49aaa422020-06-24 08:10:42 -050021@@ -680,6 +680,21 @@ void xhci_stop(struct usb_hcd *hcd)
Joel Stanley2b0f7b42016-07-19 23:26:28 +093022
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
Klaus Heinrich Kiwi49aaa422020-06-24 08:10:42 -050043@@ -691,11 +706,6 @@ void xhci_stop(struct usb_hcd *hcd)
Joel Stanley2b0f7b42016-07-19 23:26:28 +093044 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 */
Klaus Heinrich Kiwi49aaa422020-06-24 08:10:42 -050055--
561.9.4
57