Linux Renesas SOC kernel development
 help / color / mirror / Atom feed
* [PATCH] usb: host: xhci-hub: avoid xhci_warn() when PORT_PE was clear.
@ 2018-01-31 11:58 Yoshihiro Shimoda
  2018-01-31 12:28 ` Mathias Nyman
  0 siblings, 1 reply; 3+ messages in thread
From: Yoshihiro Shimoda @ 2018-01-31 11:58 UTC (permalink / raw)
  To: mathias.nyman, gregkh
  Cc: stern, linux-usb, linux-renesas-soc, Yoshihiro Shimoda

The commit 37be66767e3c ("usb: hub: Fix auto-remount of safely removed
or ejected USB-3 devices") causes the following error when we
disconnected a usb 3.0 device on some environment (e.g. R-Car H3):

 xhci-hcd ee000000.usb: Cannot set link state.
 usb usb8-port1: cannot disable (err = -32)

According to Figure 35 in xhci spec, the PED (PORT_PE) will
be set to 0 after the usb3 root hub enters "Error" or "Disconnected"
state. So, this patch avoids the error messages to return -ENODEV when
asked to set the USB_PORT_FEAT_LINK_STATE feature to U3 and PORT_PE
was clear.

Suggested-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/host/xhci-hub.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 2a90229..7e95f9e 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -1229,8 +1229,11 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 			 * port link state above '3' (U3) and the port
 			 * must be enabled.
 			 */
-			if ((temp & PORT_PE) == 0 ||
-				(link_state > USB_SS_PORT_LS_U3)) {
+			if ((temp & PORT_PE) == 0) {
+				retval = -ENODEV;
+				break;
+			}
+			if (link_state > USB_SS_PORT_LS_U3) {
 				xhci_warn(xhci, "Cannot set link state.\n");
 				goto error;
 			}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-01  2:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-31 11:58 [PATCH] usb: host: xhci-hub: avoid xhci_warn() when PORT_PE was clear Yoshihiro Shimoda
2018-01-31 12:28 ` Mathias Nyman
2018-02-01  2:09   ` Yoshihiro Shimoda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox