From: Alan Stern Date: Fri, 25 Jan 2013 22:17:43 +0000 (-0500) Subject: UPSTREAM: USB: EHCI: fix timer bug affecting port resume X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=b45415014410d2a8fc5cabd7f4adbb665e999a23;p=cascardo%2Flinux.git UPSTREAM: USB: EHCI: fix timer bug affecting port resume commit ee74290b7853db9d5fd64db70e5c175241c59fba upstream. This patch (as1652) fixes a long-standing bug in ehci-hcd. The driver relies on status polls to know when to stop port-resume signalling. It uses the root-hub status timer to schedule these status polls. But when the driver for the root hub is resumed, the timer is rescheduled to go off immediately -- before the port is ready. When this happens the timer does not get re-enabled, which prevents the port resume from finishing until some other event occurs. The symptom is that when a new device is plugged in, it doesn't get recognized or enumerated until lsusb is run or something else happens. The solution is to re-enable the root-hub status timer after every status poll while a port resume is in progress. This bug hasn't surfaced before now because we never used to try to suspend the root hub in the middle of a port resume (except by coincidence). Signed-off-by: Alan Stern Reported-and-tested-by: Norbert Preining Tested-by: Ming Lei Signed-off-by: Greg Kroah-Hartman (cherry picked from commit f4cc7a1602ed1bb673cf86b6ccc10f72e1cfaae4) BUG=None TEST=Together with other cherry-picks: run BVT trybots on all platforms, manually confirm that USB network/storage/input devices still work (including across suspend/resume) Change-Id: I50a29840acf80ffca3f830b64679c36605f2808e Signed-off-by: Julius Werner Reviewed-on: https://gerrit.chromium.org/gerrit/46073 Reviewed-by: Vincent Palatin --- diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 0bd483c7c9c0..71f98081844f 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -612,7 +612,11 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf) status = STS_PCD; } } - /* FIXME autosuspend idle root hubs */ + + /* If a resume is in progress, make sure it can finish */ + if (ehci->resuming_ports) + mod_timer(&hcd->rh_timer, jiffies + msecs_to_jiffies(25)); + spin_unlock_irqrestore (&ehci->lock, flags); return status ? retval : 0; }