This is a note to let you know that I've just added the patch titled

     Subject: [PATCH] USB: fix warning caused by autosuspend counter going 
negative

to my gregkh-2.6 tree.  Its filename is

     usb-fix-warning-caused-by-autosuspend-counter-going-negative.patch

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


>From [EMAIL PROTECTED] Mon Jul 16 12:28:27 2007
From: Alan Stern <[EMAIL PROTECTED]>
Date: Mon, 16 Jul 2007 15:28:19 -0400 (EDT)
Subject: [PATCH] USB: fix warning caused by autosuspend counter going negative
To: Greg KH <[EMAIL PROTECTED]>
Cc: USB development list <linux-usb-devel@lists.sourceforge.net>
Message-ID: <[EMAIL PROTECTED]>


This patch (as937) fixes a minor bug in the autosuspend usage-counting
code.  Each hub's usage counter keeps track of the number of
unsuspended children.  However the current driver increments the
counter after registering a new child, by which time the child may
already have been suspended and caused the counter to go negative.
The obvious solution is to increment the counter before registering
the child.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Cc: stable <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/usb/core/hub.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1333,6 +1333,10 @@ int usb_new_device(struct usb_device *ud
        udev->dev.devt = MKDEV(USB_DEVICE_MAJOR,
                        (((udev->bus->busnum-1) * 128) + (udev->devnum-1)));
 
+       /* Increment the parent's count of unsuspended children */
+       if (udev->parent)
+               usb_autoresume_device(udev->parent);
+
        /* Register the device.  The device driver is responsible
         * for adding the device files to sysfs and for configuring
         * the device.
@@ -1340,13 +1344,11 @@ int usb_new_device(struct usb_device *ud
        err = device_add(&udev->dev);
        if (err) {
                dev_err(&udev->dev, "can't device_add, error %d\n", err);
+               if (udev->parent)
+                       usb_autosuspend_device(udev->parent);
                goto fail;
        }
 
-       /* Increment the parent's count of unsuspended children */
-       if (udev->parent)
-               usb_autoresume_device(udev->parent);
-
 exit:
        return err;
 


Patches currently in gregkh-2.6 which might be from [EMAIL PROTECTED] are

driver/pm-remove-deprecated-sysfs-files.patch
driver/pm-remove-deprecated-dpm_runtime_-routines.patch
usb/usb-add-descriptors-binary-sysfs-attribute.patch
usb/usb-documentation-update-for-usb_unlink_urb.patch
usb/usb-fix-warning-caused-by-autosuspend-counter-going-negative.patch
usb/uhci-short-control-urbs-get-a-status-stage.patch
usb/isp116x-hcd-prepare-for-urb-status.patch

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to