All of lore.kernel.org
 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
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

* usb: host: xhci-hub: avoid xhci_warn() when PORT_PE was clear.
@ 2018-01-31 11:58 ` Yoshihiro Shimoda
  0 siblings, 0 replies; 6+ 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;
 			}

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

* Re: [PATCH] usb: host: xhci-hub: avoid xhci_warn() when PORT_PE was clear.
@ 2018-01-31 12:28   ` Mathias Nyman
  0 siblings, 0 replies; 6+ messages in thread
From: Mathias Nyman @ 2018-01-31 12:28 UTC (permalink / raw)
  To: Yoshihiro Shimoda, mathias.nyman, gregkh
  Cc: stern, linux-usb, linux-renesas-soc

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@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;
>   			}
> 

Thanks.
Didn't notice this before writing a similar patch.
Anyway, I'll make sure one of them goes forward after rc1

-Mathias  

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

* usb: host: xhci-hub: avoid xhci_warn() when PORT_PE was clear.
@ 2018-01-31 12:28   ` Mathias Nyman
  0 siblings, 0 replies; 6+ messages in thread
From: Mathias Nyman @ 2018-01-31 12:28 UTC (permalink / raw)
  To: Yoshihiro Shimoda, mathias.nyman, gregkh
  Cc: stern, linux-usb, linux-renesas-soc

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@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;
>   			}
> 

Thanks.
Didn't notice this before writing a similar patch.
Anyway, I'll make sure one of them goes forward after rc1

-Mathias
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH] usb: host: xhci-hub: avoid xhci_warn() when PORT_PE was clear.
@ 2018-02-01  2:09     ` Yoshihiro Shimoda
  0 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2018-02-01  2:09 UTC (permalink / raw)
  To: Mathias Nyman, mathias.nyman, gregkh; +Cc: stern, linux-usb, linux-renesas-soc

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@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;
> >   			}
> >
> 
> 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

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

* usb: host: xhci-hub: avoid xhci_warn() when PORT_PE was clear.
@ 2018-02-01  2:09     ` Yoshihiro Shimoda
  0 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2018-02-01  2:09 UTC (permalink / raw)
  To: Mathias Nyman, mathias.nyman, gregkh; +Cc: stern, linux-usb, linux-renesas-soc

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@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;
> >   			}
> >
> 
> 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

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

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

Thread overview: 6+ 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 11:58 ` Yoshihiro Shimoda
2018-01-31 12:28 ` [PATCH] " Mathias Nyman
2018-01-31 12:28   ` Mathias Nyman
2018-02-01  2:09   ` [PATCH] " Yoshihiro Shimoda
2018-02-01  2:09     ` Yoshihiro Shimoda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.