| Joel Stanley | 8ac6ef0 | 2016-12-14 15:12:16 +1030 | [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 | 6a0ced9 | 2017-05-03 13:41:44 +0930 | [diff] [blame] | 4 | Subject: [PATCH 2/4] 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 |  | 
| Joel Stanley | 2b0f7b4 | 2016-07-19 23:26:28 +0930 | [diff] [blame] | 10 | Signed-off-by: Joel Stanley <joel@jms.id.au> | 
 | 11 | --- | 
 | 12 |  drivers/usb/host/xhci.c | 20 +++++++++++++++----- | 
 | 13 |  1 file changed, 15 insertions(+), 5 deletions(-) | 
 | 14 |  | 
 | 15 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c | 
| Joel Stanley | f85edaf | 2017-06-23 13:43:06 +0930 | [diff] [blame] | 16 | index b1f779817ffe..662106a8dfc0 100644 | 
| Joel Stanley | 2b0f7b4 | 2016-07-19 23:26:28 +0930 | [diff] [blame] | 17 | --- a/drivers/usb/host/xhci.c | 
 | 18 | +++ b/drivers/usb/host/xhci.c | 
| Joel Stanley | e50183f | 2017-02-28 12:17:46 +1030 | [diff] [blame] | 19 | @@ -689,6 +689,21 @@ void xhci_stop(struct usb_hcd *hcd) | 
| Joel Stanley | 2b0f7b4 | 2016-07-19 23:26:28 +0930 | [diff] [blame] | 20 |   | 
 | 21 |  	mutex_lock(&xhci->mutex); | 
 | 22 |   | 
 | 23 | +	/* | 
 | 24 | +	 * We can't halt the secondary HCD, because it's also the primary | 
 | 25 | +	 * HCD, which will cause problems if we have devices attached to the | 
 | 26 | +	 * primary HCD, like a keyboard. | 
 | 27 | +	 */ | 
 | 28 | +	if (!usb_hcd_is_primary_hcd(hcd)) { | 
 | 29 | +		/* The shared_hcd is going to be deallocated shortly (the USB | 
 | 30 | +		 * core only calls this function when allocation fails in | 
 | 31 | +		 * usb_add_hcd(), or usb_remove_hcd() is called).  So we need | 
 | 32 | +		 * to unset xHCI's pointer.  */ | 
 | 33 | +		xhci->shared_hcd = NULL; | 
 | 34 | +		mutex_unlock(&xhci->mutex); | 
 | 35 | +		return; | 
 | 36 | +	} | 
 | 37 | + | 
 | 38 |  	if (!(xhci->xhc_state & XHCI_STATE_HALTED)) { | 
 | 39 |  		spin_lock_irq(&xhci->lock); | 
 | 40 |   | 
| Joel Stanley | e50183f | 2017-02-28 12:17:46 +1030 | [diff] [blame] | 41 | @@ -699,11 +714,6 @@ void xhci_stop(struct usb_hcd *hcd) | 
| Joel Stanley | 2b0f7b4 | 2016-07-19 23:26:28 +0930 | [diff] [blame] | 42 |  		spin_unlock_irq(&xhci->lock); | 
 | 43 |  	} | 
 | 44 |   | 
 | 45 | -	if (!usb_hcd_is_primary_hcd(hcd)) { | 
 | 46 | -		mutex_unlock(&xhci->mutex); | 
 | 47 | -		return; | 
 | 48 | -	} | 
 | 49 | - | 
 | 50 |  	xhci_cleanup_msix(xhci); | 
 | 51 |   | 
 | 52 |  	/* Deleting Compliance Mode Recovery Timer */ | 
 | 53 | --  | 
| Joel Stanley | 8ac6ef0 | 2016-12-14 15:12:16 +1030 | [diff] [blame] | 54 | 2.11.0 | 
| Joel Stanley | 2b0f7b4 | 2016-07-19 23:26:28 +0930 | [diff] [blame] | 55 |  |