USB: fix race in autosuspend reschedule
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 11 Oct 2007 20:47:36 +0000 (16:47 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 12 Oct 2007 21:55:35 +0000 (14:55 -0700)
commitd1aa3e6aa8edfeb864af7c930523d9e588b28bea
tree1ad0e6ead73cccc43dd1c1997aabb25acb4970d2
parent58ed7b94d98245fbad54a0af7ea3317ab1dd6876
USB: fix race in autosuspend reschedule

This patch (as1002) fixes a small race which can occur when a driver
expects usbcore to reschedule an autosuspend request.  If the request
arrives too late, it won't be rescheduled.  The patch adds an extra
argument to autosuspend_check(), indicating that a reschedule is
needed no matter how much time has elapsed.

It also tries to avoid letting asynchronous changes to the value of
jiffies cause a delay to become negative, by caching a local copy of
the current time.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/driver.c