Joel Stanley | d9669fe | 2016-01-22 16:13:06 +1030 | [diff] [blame^] | 1 | From 8afabdc0db0f80e45c9bfdeb3faadaa89d4dd775 Mon Sep 17 00:00:00 2001 |
| 2 | From: Joel Stanley <joel@jms.id.au> |
| 3 | Date: Thu, 28 Jan 2016 13:07:06 +1030 |
| 4 | Subject: [PATCH 2/5] Revert "usb: xhci: stop everything on the first call to |
| 5 | xhci_stop" |
| 6 | |
| 7 | This reverts commit 8c24d6d7b09deee3036ddc4f2b81b53b28c8f877. |
| 8 | |
| 9 | With this patch, the driver stops everything at the first call to |
| 10 | xhci_stop, which is always for the secondary HCD when executing the |
| 11 | .remove handler. We instead want to only stop when the primray HCD is |
| 12 | shutting down. |
| 13 | |
| 14 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
| 15 | --- |
| 16 | drivers/usb/host/xhci.c | 20 +++++++++++++++----- |
| 17 | 1 file changed, 15 insertions(+), 5 deletions(-) |
| 18 | |
| 19 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
| 20 | index 3f912705dcef..2cc689a3b549 100644 |
| 21 | --- a/drivers/usb/host/xhci.c |
| 22 | +++ b/drivers/usb/host/xhci.c |
| 23 | @@ -665,6 +665,15 @@ int xhci_run(struct usb_hcd *hcd) |
| 24 | } |
| 25 | EXPORT_SYMBOL_GPL(xhci_run); |
| 26 | |
| 27 | +static void xhci_only_stop_hcd(struct usb_hcd *hcd) |
| 28 | +{ |
| 29 | + struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| 30 | + |
| 31 | + spin_lock_irq(&xhci->lock); |
| 32 | + xhci_halt(xhci); |
| 33 | + spin_unlock_irq(&xhci->lock); |
| 34 | +} |
| 35 | + |
| 36 | /* |
| 37 | * Stop xHCI driver. |
| 38 | * |
| 39 | @@ -679,14 +688,15 @@ void xhci_stop(struct usb_hcd *hcd) |
| 40 | u32 temp; |
| 41 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| 42 | |
| 43 | - if (xhci->xhc_state & XHCI_STATE_HALTED) |
| 44 | + mutex_lock(&xhci->mutex); |
| 45 | + |
| 46 | + if (!usb_hcd_is_primary_hcd(hcd)) { |
| 47 | + xhci_only_stop_hcd(xhci->shared_hcd); |
| 48 | + mutex_unlock(&xhci->mutex); |
| 49 | return; |
| 50 | + } |
| 51 | |
| 52 | - mutex_lock(&xhci->mutex); |
| 53 | spin_lock_irq(&xhci->lock); |
| 54 | - xhci->xhc_state |= XHCI_STATE_HALTED; |
| 55 | - xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; |
| 56 | - |
| 57 | /* Make sure the xHC is halted for a USB3 roothub |
| 58 | * (xhci_stop() could be called as part of failed init). |
| 59 | */ |
| 60 | -- |
| 61 | 2.7.0.rc3 |
| 62 | |