Joel Stanley | b314cb5 | 2017-06-07 14:51:57 +0930 | [diff] [blame^] | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
Joel Stanley | 2b0f7b4 | 2016-07-19 23:26:28 +0930 | [diff] [blame] | 2 | From: Joel Stanley <joel@jms.id.au> |
| 3 | Date: Tue, 19 Jul 2016 22:43:26 +0930 |
Joel Stanley | b314cb5 | 2017-06-07 14:51:57 +0930 | [diff] [blame^] | 4 | Subject: [PATCH 04/11] xhci: do not halt the secondary HCD |
Joel Stanley | 2b0f7b4 | 2016-07-19 23:26:28 +0930 | [diff] [blame] | 5 | |
| 6 | We can't halt the secondary HCD, because it's also the primary HCD, |
| 7 | which will cause problems if we have devices attached to the primary |
| 8 | HCD, like a keyboard. |
| 9 | |
| 10 | Sined-off-by: Joel Stanley <joel@jms.id.au> |
| 11 | Signed-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 | |
| 16 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
Joel Stanley | b314cb5 | 2017-06-07 14:51:57 +0930 | [diff] [blame^] | 17 | index f2e9f59c90d6..28fad2949308 100644 |
Joel Stanley | 2b0f7b4 | 2016-07-19 23:26:28 +0930 | [diff] [blame] | 18 | --- 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 Stanley | b314cb5 | 2017-06-07 14:51:57 +0930 | [diff] [blame^] | 55 | 2.11.0 |
Joel Stanley | 2b0f7b4 | 2016-07-19 23:26:28 +0930 | [diff] [blame] | 56 | |