linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: hub: move resume delay at the head of all USB access functions
@ 2019-12-20  2:59 AceLan Kao
  2019-12-20 15:48 ` Alan Stern
  0 siblings, 1 reply; 9+ messages in thread
From: AceLan Kao @ 2019-12-20  2:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Alan Stern, Kai-Heng Feng, Thinh Nguyen,
	Harry Pan, David Heinzelmann, Andrey Konovalov,
	Nicolas Saenz Julienne, Mathieu Malaterre, linux-usb,
	linux-kernel

usb_control_msg() function should be called after the resume delay, or
you'll encounter the below errors sometime.
After the issue happens, have to re-plug the USB cable to recover.

[ 837.483573] hub 2-3:1.0: hub_ext_port_status failed (err = -71)
[ 837.490889] hub 2-3:1.0: hub_ext_port_status failed (err = -71)
[ 837.506780] usb 2-3-port4: cannot disable (err = -71)

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
---
 drivers/usb/core/hub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f229ad6952c0..2fb2816b0d38 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3522,6 +3522,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
 		}
 	}
 
+	msleep(USB_RESUME_TIMEOUT);
 	usb_lock_port(port_dev);
 
 	/* Skip the initial Clear-Suspend step for a remote wakeup */
@@ -3544,7 +3545,6 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
 		/* drive resume for USB_RESUME_TIMEOUT msec */
 		dev_dbg(&udev->dev, "usb %sresume\n",
 				(PMSG_IS_AUTO(msg) ? "auto-" : ""));
-		msleep(USB_RESUME_TIMEOUT);
 
 		/* Virtual root hubs can trigger on GET_PORT_STATUS to
 		 * stop resume signaling.  Then finish the resume
-- 
2.17.1


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

end of thread, other threads:[~2020-01-03  5:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-20  2:59 [PATCH] usb: hub: move resume delay at the head of all USB access functions AceLan Kao
2019-12-20 15:48 ` Alan Stern
2019-12-23  4:29   ` AceLan Kao
2019-12-24 15:23     ` Alan Stern
2019-12-25  3:15       ` AceLan Kao
2019-12-26  4:13         ` Pan, Harry
2019-12-26  9:07           ` AceLan Kao
2020-01-02 21:37         ` Alan Stern
2020-01-03  5:26           ` Kai-Heng Feng

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).