aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-04-11 12:06:16 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 16:28:39 -0400
commit8c9862e512f59ae3f41f83c109be12f93e37bb2d (patch)
tree04eb8196495fe609405e3cfc0e1774160131132a
parentecb658d387dc09f344b3d755e8674076072032c7 (diff)
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 <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/core/driver.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 631f30582481..b9f7f90aef82 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)
932{ 932{
933 int i; 933 int i;
934 struct usb_interface *intf; 934 struct usb_interface *intf;
935 long suspend_time; 935 unsigned long suspend_time;
936 936
937 /* For autosuspend, fail fast if anything is in use or autosuspend 937 /* For autosuspend, fail fast if anything is in use or autosuspend
938 * is disabled. Also fail if any interfaces require remote wakeup 938 * is disabled. Also fail if any interfaces require remote wakeup
@@ -964,11 +964,18 @@ static int autosuspend_check(struct usb_device *udev)
964 /* If everything is okay but the device hasn't been idle for long 964 /* If everything is okay but the device hasn't been idle for long
965 * enough, queue a delayed autosuspend request. 965 * enough, queue a delayed autosuspend request.
966 */ 966 */
967 suspend_time -= jiffies; 967 if (time_after(suspend_time, jiffies)) {
968 if (suspend_time > 0) { 968 if (!timer_pending(&udev->autosuspend.timer)) {
969 if (!timer_pending(&udev->autosuspend.timer)) 969
970 /* The value of jiffies may change between the
971 * time_after() comparison above and the subtraction
972 * below. That's okay; the system behaves sanely
973 * when a timer is registered for the present moment
974 * or for the past.
975 */
970 queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend, 976 queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend,
971 suspend_time); 977 suspend_time - jiffies);
978 }
972 return -EAGAIN; 979 return -EAGAIN;
973 } 980 }
974 return 0; 981 return 0;