Hi, > From: Mathias Nyman, Sent: Wednesday, January 31, 2018 9:29 PM > > On 31.01.2018 13:58, Yoshihiro Shimoda wrote: > > 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@xxxxxxxxxxxxxxx> > > Suggested-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> > > --- > > 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; > > } > > > > Thanks. > Didn't notice this before writing a similar patch. > Anyway, I'll make sure one of them goes forward after rc1 I think your patch is better than my patch. So, I'll test your patch later. Best regards, Yoshihiro Shimoda > -Mathias ��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥