Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8c9862e512f59ae3f41f83c109be12f93e37bb2d Commit: 8c9862e512f59ae3f41f83c109be12f93e37bb2d Parent: ecb658d387dc09f344b3d755e8674076072032c7 Author: Alan Stern <[EMAIL PROTECTED]> AuthorDate: Wed Apr 11 12:06:16 2007 -0400 Committer: Greg Kroah-Hartman <[EMAIL PROTECTED]> CommitDate: Fri Apr 27 13:28:39 2007 -0700
USB: fix signed jiffies issue in autosuspend logic This patch (as897) changes the autosuspend timer code to use the standard types and macros in dealing with jiffies values. Signed-off-by: Alan Stern <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/usb/core/driver.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 631f305..b9f7f90 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -932,7 +932,7 @@ static int autosuspend_check(struct usb_device *udev) { int i; struct usb_interface *intf; - long suspend_time; + unsigned long suspend_time; /* For autosuspend, fail fast if anything is in use or autosuspend * is disabled. Also fail if any interfaces require remote wakeup @@ -964,11 +964,18 @@ static int autosuspend_check(struct usb_device *udev) /* If everything is okay but the device hasn't been idle for long * enough, queue a delayed autosuspend request. */ - suspend_time -= jiffies; - if (suspend_time > 0) { - if (!timer_pending(&udev->autosuspend.timer)) + if (time_after(suspend_time, jiffies)) { + if (!timer_pending(&udev->autosuspend.timer)) { + + /* The value of jiffies may change between the + * time_after() comparison above and the subtraction + * below. That's okay; the system behaves sanely + * when a timer is registered for the present moment + * or for the past. + */ queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend, - suspend_time); + suspend_time - jiffies); + } return -EAGAIN; } return 0; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html