LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: [PATCH] Revert "usb: Reset USB-3 devices on USB-3 link bounce"
  2015-01-26 15:30 [PATCH] Revert "usb: Reset USB-3 devices on USB-3 link bounce" Zhuang Jin Can
@ 2015-01-26 14:37 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2015-01-26 14:37 UTC (permalink / raw)
  To: jin.can.zhuang, gregkh, stern, dan.j.williams, pmladek,
	peter.chen, mathias.nyman
  Cc: linux-usb, linux-kernel

Hi,

On 26-01-15 16:30, Zhuang Jin Can wrote:
> This revert a82b76f7fa6154e8ab2d8071842a3e38b9c0d0ff.
>
> The commit causes an extra reset in remote wakeup as described in:
> http://www.spinics.net/lists/linux-usb/msg119080.html
>
> Signed-off-by: Zhuang Jin Can <jin.can.zhuang@intel.com>

No objection from me (*) against reverting this, as it was fixing a
rather obscure (but non the less real) issue, and the issue it
causes seems to be a bigger one.

Regards,

Hans

*) I'm the author of the original patch


> ---
>   drivers/usb/core/hub.c |   34 +++++++++-------------------------
>   1 file changed, 9 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index aeb50bb..89d009a 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -4882,7 +4882,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
>   static void port_event(struct usb_hub *hub, int port1)
>   		__must_hold(&port_dev->status_lock)
>   {
> -	int connect_change, reset_device = 0;
> +	int connect_change;
>   	struct usb_port *port_dev = hub->ports[port1 - 1];
>   	struct usb_device *udev = port_dev->child;
>   	struct usb_device *hdev = hub->hdev;
> @@ -4970,30 +4970,14 @@ static void port_event(struct usb_hub *hub, int port1)
>   			if (hub_port_reset(hub, port1, NULL,
>   					HUB_BH_RESET_TIME, true) < 0)
>   				hub_port_disable(hub, port1, 1);
> -		} else
> -			reset_device = 1;
> -	}
> -
> -	/*
> -	 * On disconnect USB3 protocol ports transit from U0 to
> -	 * SS.Inactive to Rx.Detect. If this happens a warm-
> -	 * reset is not needed, but a (re)connect may happen
> -	 * before hub_wq runs and sees the disconnect, and the
> -	 * device may be an unknown state.
> -	 *
> -	 * If the port went through SS.Inactive without hub_wq
> -	 * seeing it the C_LINK_STATE change flag will be set,
> -	 * and we reset the dev to put it in a known state.
> -	 */
> -	if (reset_device || (udev && hub_is_superspeed(hub->hdev)
> -				&& (portchange & USB_PORT_STAT_C_LINK_STATE)
> -				&& (portstatus & USB_PORT_STAT_CONNECTION))) {
> -		usb_unlock_port(port_dev);
> -		usb_lock_device(udev);
> -		usb_reset_device(udev);
> -		usb_unlock_device(udev);
> -		usb_lock_port(port_dev);
> -		connect_change = 0;
> +		} else {
> +			usb_unlock_port(port_dev);
> +			usb_lock_device(udev);
> +			usb_reset_device(udev);
> +			usb_unlock_device(udev);
> +			usb_lock_port(port_dev);
> +			connect_change = 0;
> +		}
>   	}
>
>   	if (connect_change)
>

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

* [PATCH] Revert "usb: Reset USB-3 devices on USB-3 link bounce"
@ 2015-01-26 15:30 Zhuang Jin Can
  2015-01-26 14:37 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Zhuang Jin Can @ 2015-01-26 15:30 UTC (permalink / raw)
  To: gregkh, stern, dan.j.williams, pmladek, peter.chen, hdegoede,
	mathias.nyman
  Cc: linux-usb, linux-kernel, jin.can.zhuang

This revert a82b76f7fa6154e8ab2d8071842a3e38b9c0d0ff.

The commit causes an extra reset in remote wakeup as described in:
http://www.spinics.net/lists/linux-usb/msg119080.html

Signed-off-by: Zhuang Jin Can <jin.can.zhuang@intel.com>
---
 drivers/usb/core/hub.c |   34 +++++++++-------------------------
 1 file changed, 9 insertions(+), 25 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index aeb50bb..89d009a 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4882,7 +4882,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 static void port_event(struct usb_hub *hub, int port1)
 		__must_hold(&port_dev->status_lock)
 {
-	int connect_change, reset_device = 0;
+	int connect_change;
 	struct usb_port *port_dev = hub->ports[port1 - 1];
 	struct usb_device *udev = port_dev->child;
 	struct usb_device *hdev = hub->hdev;
@@ -4970,30 +4970,14 @@ static void port_event(struct usb_hub *hub, int port1)
 			if (hub_port_reset(hub, port1, NULL,
 					HUB_BH_RESET_TIME, true) < 0)
 				hub_port_disable(hub, port1, 1);
-		} else
-			reset_device = 1;
-	}
-
-	/*
-	 * On disconnect USB3 protocol ports transit from U0 to
-	 * SS.Inactive to Rx.Detect. If this happens a warm-
-	 * reset is not needed, but a (re)connect may happen
-	 * before hub_wq runs and sees the disconnect, and the
-	 * device may be an unknown state.
-	 *
-	 * If the port went through SS.Inactive without hub_wq
-	 * seeing it the C_LINK_STATE change flag will be set,
-	 * and we reset the dev to put it in a known state.
-	 */
-	if (reset_device || (udev && hub_is_superspeed(hub->hdev)
-				&& (portchange & USB_PORT_STAT_C_LINK_STATE)
-				&& (portstatus & USB_PORT_STAT_CONNECTION))) {
-		usb_unlock_port(port_dev);
-		usb_lock_device(udev);
-		usb_reset_device(udev);
-		usb_unlock_device(udev);
-		usb_lock_port(port_dev);
-		connect_change = 0;
+		} else {
+			usb_unlock_port(port_dev);
+			usb_lock_device(udev);
+			usb_reset_device(udev);
+			usb_unlock_device(udev);
+			usb_lock_port(port_dev);
+			connect_change = 0;
+		}
 	}
 
 	if (connect_change)
-- 
1.7.9.5


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

end of thread, other threads:[~2015-01-26 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 15:30 [PATCH] Revert "usb: Reset USB-3 devices on USB-3 link bounce" Zhuang Jin Can
2015-01-26 14:37 ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).