All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: core: Check portchange C_PORT_RESET after resetting
@ 2018-10-03  5:18 ` Kai-Heng Feng
  0 siblings, 0 replies; 4+ messages in thread
From: Kai-Heng Feng @ 2018-10-03  5:18 UTC (permalink / raw)
  To: gregkh; +Cc: stern, linux-usb, linux-kernel, Kai-Heng Feng

Based on USB2.0 Spec Section 11.24.2.7.2.5:

  "This bit is set when the port transitions from the Resetting state (or,
  if present, the Speed_eval state) to the Enabled state."

Also Section 11.24.2.13:

  "Setting the reset feature PORT_RESET causes the hub to signal reset on
  that port. When the reset signaling is complete, the hub sets the
  C_PORT_RESET status change and immediately enables the port."

So let's also check C_PORT_RESET for reset completion.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/usb/core/hub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 7801bb30bdba..d96058372280 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2721,7 +2721,8 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
 		 * so also wait for the connection to be re-established.
 		 */
 		if (!(portstatus & USB_PORT_STAT_RESET) &&
-		    (portstatus & USB_PORT_STAT_CONNECTION))
+		    (portstatus & USB_PORT_STAT_CONNECTION) &&
+		    (portchange & USB_PORT_STAT_C_RESET))
 			break;
 
 		/* switch to the long delay after two short delay failures */
-- 
2.17.1


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

* usb: core: Check portchange C_PORT_RESET after resetting
@ 2018-10-03  5:18 ` Kai-Heng Feng
  0 siblings, 0 replies; 4+ messages in thread
From: Kai-Heng Feng @ 2018-10-03  5:18 UTC (permalink / raw)
  To: gregkh; +Cc: stern, linux-usb, linux-kernel, Kai-Heng Feng

Based on USB2.0 Spec Section 11.24.2.7.2.5:

  "This bit is set when the port transitions from the Resetting state (or,
  if present, the Speed_eval state) to the Enabled state."

Also Section 11.24.2.13:

  "Setting the reset feature PORT_RESET causes the hub to signal reset on
  that port. When the reset signaling is complete, the hub sets the
  C_PORT_RESET status change and immediately enables the port."

So let's also check C_PORT_RESET for reset completion.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/usb/core/hub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 7801bb30bdba..d96058372280 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2721,7 +2721,8 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
 		 * so also wait for the connection to be re-established.
 		 */
 		if (!(portstatus & USB_PORT_STAT_RESET) &&
-		    (portstatus & USB_PORT_STAT_CONNECTION))
+		    (portstatus & USB_PORT_STAT_CONNECTION) &&
+		    (portchange & USB_PORT_STAT_C_RESET))
 			break;
 
 		/* switch to the long delay after two short delay failures */

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

* Re: [PATCH] usb: core: Check portchange C_PORT_RESET after resetting
@ 2018-10-03 13:57   ` Alan Stern
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Stern @ 2018-10-03 13:57 UTC (permalink / raw)
  To: Kai-Heng Feng; +Cc: gregkh, linux-usb, linux-kernel

On Wed, 3 Oct 2018, Kai-Heng Feng wrote:

> Based on USB2.0 Spec Section 11.24.2.7.2.5:
> 
>   "This bit is set when the port transitions from the Resetting state (or,
>   if present, the Speed_eval state) to the Enabled state."
> 
> Also Section 11.24.2.13:
> 
>   "Setting the reset feature PORT_RESET causes the hub to signal reset on
>   that port. When the reset signaling is complete, the hub sets the
>   C_PORT_RESET status change and immediately enables the port."
> 
> So let's also check C_PORT_RESET for reset completion.
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/usb/core/hub.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 7801bb30bdba..d96058372280 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -2721,7 +2721,8 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
>  		 * so also wait for the connection to be re-established.
>  		 */
>  		if (!(portstatus & USB_PORT_STAT_RESET) &&
> -		    (portstatus & USB_PORT_STAT_CONNECTION))
> +		    (portstatus & USB_PORT_STAT_CONNECTION) &&
> +		    (portchange & USB_PORT_STAT_C_RESET))
>  			break;
>  
>  		/* switch to the long delay after two short delay failures */

What is the purpose of this patch?  Does it fix a problem?

Alan Stern


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

* usb: core: Check portchange C_PORT_RESET after resetting
@ 2018-10-03 13:57   ` Alan Stern
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Stern @ 2018-10-03 13:57 UTC (permalink / raw)
  To: Kai-Heng Feng; +Cc: gregkh, linux-usb, linux-kernel

On Wed, 3 Oct 2018, Kai-Heng Feng wrote:

> Based on USB2.0 Spec Section 11.24.2.7.2.5:
> 
>   "This bit is set when the port transitions from the Resetting state (or,
>   if present, the Speed_eval state) to the Enabled state."
> 
> Also Section 11.24.2.13:
> 
>   "Setting the reset feature PORT_RESET causes the hub to signal reset on
>   that port. When the reset signaling is complete, the hub sets the
>   C_PORT_RESET status change and immediately enables the port."
> 
> So let's also check C_PORT_RESET for reset completion.
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/usb/core/hub.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 7801bb30bdba..d96058372280 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -2721,7 +2721,8 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
>  		 * so also wait for the connection to be re-established.
>  		 */
>  		if (!(portstatus & USB_PORT_STAT_RESET) &&
> -		    (portstatus & USB_PORT_STAT_CONNECTION))
> +		    (portstatus & USB_PORT_STAT_CONNECTION) &&
> +		    (portchange & USB_PORT_STAT_C_RESET))
>  			break;
>  
>  		/* switch to the long delay after two short delay failures */

What is the purpose of this patch?  Does it fix a problem?

Alan Stern

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

end of thread, other threads:[~2018-10-03 13:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-03  5:18 [PATCH] usb: core: Check portchange C_PORT_RESET after resetting Kai-Heng Feng
2018-10-03  5:18 ` Kai-Heng Feng
2018-10-03 13:57 ` [PATCH] " Alan Stern
2018-10-03 13:57   ` Alan Stern

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.