Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=013d27f265de6934ad7fb48fb29ab0172a20ab40
Commit:     013d27f265de6934ad7fb48fb29ab0172a20ab40
Parent:     85237f202d46d55c1bffe0c5b1aa3ddc0f1dce4d
Author:     Alan Stern <[EMAIL PROTECTED]>
AuthorDate: Mon Aug 20 12:18:39 2007 -0400
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Aug 22 14:27:59 2007 -0700

    USB: update last_busy field correctly
    
    This patch (as966) fixes a bug in the autosuspend code.  The last_busy
    field should be updated whenever any event occurs, not just events
    that cause an autosuspend or an autoresume.
    
    This partially fixes Bugzilla #8892.
    
    Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/core/driver.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 6548574..a1ad11d 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1224,6 +1224,8 @@ static int usb_autopm_do_device(struct usb_device *udev, 
int inc_usage_cnt)
        udev->auto_pm = 1;
        udev->pm_usage_cnt += inc_usage_cnt;
        WARN_ON(udev->pm_usage_cnt < 0);
+       if (inc_usage_cnt)
+               udev->last_busy = jiffies;
        if (inc_usage_cnt >= 0 && udev->pm_usage_cnt > 0) {
                if (udev->state == USB_STATE_SUSPENDED)
                        status = usb_resume_both(udev);
@@ -1232,8 +1234,6 @@ static int usb_autopm_do_device(struct usb_device *udev, 
int inc_usage_cnt)
                else if (inc_usage_cnt)
                        udev->last_busy = jiffies;
        } else if (inc_usage_cnt <= 0 && udev->pm_usage_cnt <= 0) {
-               if (inc_usage_cnt)
-                       udev->last_busy = jiffies;
                status = usb_suspend_both(udev, PMSG_SUSPEND);
        }
        usb_pm_unlock(udev);
@@ -1342,16 +1342,15 @@ static int usb_autopm_do_interface(struct usb_interface 
*intf,
        else {
                udev->auto_pm = 1;
                intf->pm_usage_cnt += inc_usage_cnt;
+               udev->last_busy = jiffies;
                if (inc_usage_cnt >= 0 && intf->pm_usage_cnt > 0) {
                        if (udev->state == USB_STATE_SUSPENDED)
                                status = usb_resume_both(udev);
                        if (status != 0)
                                intf->pm_usage_cnt -= inc_usage_cnt;
-                       else if (inc_usage_cnt)
+                       else
                                udev->last_busy = jiffies;
                } else if (inc_usage_cnt <= 0 && intf->pm_usage_cnt <= 0) {
-                       if (inc_usage_cnt)
-                               udev->last_busy = jiffies;
                        status = usb_suspend_both(udev, PMSG_SUSPEND);
                }
        }
-
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

Reply via email to