Re: error handing for usb3.0 devices

2014-04-13 Thread Greg KH
On Sun, Apr 13, 2014 at 03:43:47PM +0800, vichy wrote:
 hi all:
 When I plug in usb3.0 device for stressing test, once
 usb_get_device_descriptor fail in hub_port_init.
 we will call hub_port_disable(hub, port1, 0);
 
 And usb3.0 device may not recover successfully only with below function
 retval = hub_port_reset(hub, port1, udev, delay, false);
 when we try to save back the device.
 
 in hub_port_connect_change
 -- for (i = 0; i  SET_CONFIG_TRIES; i++) {
  -- hub_port_init
   -- hub_port_reset(hub, port1, udev, delay, false);
   -- usb_get_device_descriptor
(fail) --  hub_port_disable(hub, port1, 0);
 
 ( I list rough function calls flow like above)
 
 For covering this error handling, shall we add patch like below?
 
 diff --git drivers/usb/core/hub.c b/linux-3.8.2/drivers/usb/core/hub.c
 index 64af693..599de96 100644
 --- a/linux-3.8.2/drivers/usb/core/hub.c
 +++ b/linux-3.8.2/drivers/usb/core/hub.c
 @@ -4451,6 +4453,10 @@ static int hub_port_reset(struct usb_hub *hub, int 
 port1,
 if (retval) {
 hub_port_disable(hub, port1, 0);
 update_devnum(udev, devnum);/* for disconnect processing 
 */
 +   if(udev-speed == USB_SPEED_SUPER)
 +   hub_port_reset(hub, port1, udev,
 +   HUB_BH_RESET_TIME, true);
 }
 mutex_unlock(usb_address0_mutex);
 return retval;
 
 

Allways run your patches through checkpatch.pl so someone doesn't point
out the formatting issues in it when you send it to the mailing list :)

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


Re: error handing for usb3.0 devices

2014-04-13 Thread vichy
hi Greg:

 Allways run your patches through checkpatch.pl so someone doesn't point
 out the formatting issues in it when you send it to the mailing list :)
Here it is

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 090469e..2192776 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4316,6 +4316,9 @@ fail:
if (retval) {
hub_port_disable(hub, port1, 0);
update_devnum(udev, devnum);/* for disconnect processing */
+   if(udev-speed == USB_SPEED_SUPER)
+   hub_port_reset(hub, port1, udev,
+   HUB_BH_RESET_TIME, true);
}
mutex_unlock(usb_address0_mutex);
return retval;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 090469e..2192776 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4316,6 +4316,9 @@ fail:
 	if (retval) {
 		hub_port_disable(hub, port1, 0);
 		update_devnum(udev, devnum);	/* for disconnect processing */
+		if(udev-speed == USB_SPEED_SUPER)
+			hub_port_reset(hub, port1, udev,
+HUB_BH_RESET_TIME, true);
 	}
 	mutex_unlock(usb_address0_mutex);
 	return retval;


Re: error handing for usb3.0 devices

2014-04-13 Thread Greg KH
On Sun, Apr 13, 2014 at 10:06:15PM +0800, vichy wrote:
 hi Greg:
 
  Allways run your patches through checkpatch.pl so someone doesn't point
  out the formatting issues in it when you send it to the mailing list :)
 Here it is

You didn't actually use checkpatch.pl :(

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


Re: error handing for usb3.0 devices

2014-04-13 Thread Sergei Shtylyov

Hello.

On 04/13/2014 06:06 PM, vichy wrote:


Allways run your patches through checkpatch.pl so someone doesn't point
out the formatting issues in it when you send it to the mailing list :)


   Well, I didn't want to complain about the example patch but now I'll just 
have to... :-)



Here it is



diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 090469e..2192776 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4316,6 +4316,9 @@ fail:
 if (retval) {
 hub_port_disable(hub, port1, 0);
 update_devnum(udev, devnum);/* for disconnect processing */
+   if(udev-speed == USB_SPEED_SUPER)


   If you'd really run the patch thru checkpatch.pl, it would have complained 
about missing space after *if*. ;-)



+   hub_port_reset(hub, port1, udev,
+   HUB_BH_RESET_TIME, true);


WBR, Sergei

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


Re: error handing for usb3.0 devices

2014-04-13 Thread vichy
hi Greg and Sergei:

Well, I didn't want to complain about the example patch but now I'll just
 have to... :-)


 Here it is


 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
 index 090469e..2192776 100644
 --- a/drivers/usb/core/hub.c
 +++ b/drivers/usb/core/hub.c
 @@ -4316,6 +4316,9 @@ fail:
  if (retval) {
  hub_port_disable(hub, port1, 0);
  update_devnum(udev, devnum);/* for disconnect
 processing */
 +   if(udev-speed == USB_SPEED_SUPER)


If you'd really run the patch thru checkpatch.pl, it would have
 complained about missing space after *if*. ;-)


 +   hub_port_reset(hub, port1, udev,
 +   HUB_BH_RESET_TIME, true);
Apologizing for making you inconvenient. ^^
After reading the newbie document, I recreate it.

# ./scripts/checkpatch.pl
./0001-When-plugging-in-usb3.0-device-once-get-descriptor-o.patch
total: 0 errors, 0 warnings, 9 lines checked
./0001-When-plugging-in-usb3.0-device-once-get-descriptor-o.patch has
no obvious style problems and is ready for submission.
#
From 6915f0c8be03a79df3ee8ea5aeba2d223d822e18 Mon Sep 17 00:00:00 2001
From: vichy Kuo vichy@gmail.com
Date: Mon, 14 Apr 2014 10:03:15 +0800
Subject: [PATCH] When plugging in usb3.0 device, once get descriptor or set
 address fail in hub_port_init. We will call hub_port_disabe
 and usb3.0 device may not recover successfully only with
 not warm reset. So we add belwo warm reset when there is
 any error happen in hub_port_init.

Signed-off-by: vichy Kuo vichy@gmail.com

---
 drivers/usb/core/hub.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 090469e..0c3ca34 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4316,6 +4316,9 @@ fail:
 	if (retval) {
 		hub_port_disable(hub, port1, 0);
 		update_devnum(udev, devnum);	/* for disconnect processing */
+		if (udev-speed == USB_SPEED_SUPER)
+			hub_port_reset(hub, port1, udev,
+HUB_BH_RESET_TIME, true);
 	}
 	mutex_unlock(usb_address0_mutex);
 	return retval;
-- 
1.7.9.5