patch usb-jiffies-long.patch added to gregkh-2.6 tree

<[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
This is a note to let you know that I've just added the patch titled

     Subject: USB: jiffies is an unsigned long so treat it that way

to my gregkh-2.6 tree.  Its filename is

     usb-jiffies-long.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


>From foo@baz Tue Apr  9 12:12:43 2002
Date: Mon, 9 Apr 2007 11:52:31 -0400 (EDT)
To: Greg KH <[email protected]>
From: Greg Kroah-Hartman <[email protected]>
Subject: USB: jiffies is an unsigned long so treat it that way

In the suspend logic, we are using jiffies as a signed long, which can
cause problems.  This patch fixes this, and uses the proper function to
determine if something has expired or not, instead of attempting to roll
it ourselves.

Thanks to Oliver for helping with the unsigned/signed issues in thinking
this patch through.

Cc: Alan Stern <[email protected]>
Cc: Oliver Neukum <[email protected]>
Cc: David Brownell <[email protected]>
Cc: linux-usb-devel <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/usb/core/driver.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--- gregkh-2.6.orig/drivers/usb/core/driver.c
+++ gregkh-2.6/drivers/usb/core/driver.c
@@ -932,7 +932,7 @@ static int autosuspend_check(struct usb_
 {
 	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
@@ -944,7 +944,6 @@ static int autosuspend_check(struct usb_
 	if (udev->autosuspend_delay < 0 || udev->autosuspend_disabled)
 		return -EPERM;
 
-	suspend_time = udev->last_busy + udev->autosuspend_delay;
 	if (udev->actconfig) {
 		for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
 			intf = udev->actconfig->interface[i];
@@ -964,8 +963,8 @@ static int autosuspend_check(struct usb_
 	/* 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) {
+	suspend_time = udev->last_busy + udev->autosuspend_delay;
+	if (time_after(suspend_time, jiffies)) {
 		if (!timer_pending(&udev->autosuspend.timer))
 			queue_delayed_work(ksuspend_usb_wq, &udev->autosuspend,
 					suspend_time);


Patches currently in gregkh-2.6 which might be from [email protected] are


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.