aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-11-13 15:08:30 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-07 12:59:54 -0500
commit6cd132015d92356b1287f6f3377a3ad955b6cf2f (patch)
tree17e1f8ebe36aa69f56e80377cd02875dac2296e2 /drivers/usb
parentf150fa1afbf69a87f54752579ff2bb769aad88b3 (diff)
USB: announce new devices earlier
This patch (as1166) changes usb_new_device(). Now new devices will be announced in the log _prior_ to being registered; this way the "new device" lines will appear before all the output from driver probing, which seems much more logical. Also, the patch adds a call to usb_stop_pm() to the failure pathway, so that the parent's count of unsuspended children will remain correct if registration fails. In order for this to work properly, the code to increment that count has to be moved forward, before the first point where a failure can occur. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/hub.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index e65881899c8f..ff066edf4dca 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1636,6 +1636,10 @@ int usb_new_device(struct usb_device *udev)
1636{ 1636{
1637 int err; 1637 int err;
1638 1638
1639 /* Increment the parent's count of unsuspended children */
1640 if (udev->parent)
1641 usb_autoresume_device(udev->parent);
1642
1639 usb_detect_quirks(udev); /* Determine quirks */ 1643 usb_detect_quirks(udev); /* Determine quirks */
1640 err = usb_configure_device(udev); /* detect & probe dev/intfs */ 1644 err = usb_configure_device(udev); /* detect & probe dev/intfs */
1641 if (err < 0) 1645 if (err < 0)
@@ -1644,9 +1648,8 @@ int usb_new_device(struct usb_device *udev)
1644 udev->dev.devt = MKDEV(USB_DEVICE_MAJOR, 1648 udev->dev.devt = MKDEV(USB_DEVICE_MAJOR,
1645 (((udev->bus->busnum-1) * 128) + (udev->devnum-1))); 1649 (((udev->bus->busnum-1) * 128) + (udev->devnum-1)));
1646 1650
1647 /* Increment the parent's count of unsuspended children */ 1651 /* Tell the world! */
1648 if (udev->parent) 1652 announce_device(udev);
1649 usb_autoresume_device(udev->parent);
1650 1653
1651 /* Register the device. The device driver is responsible 1654 /* Register the device. The device driver is responsible
1652 * for adding the device files to sysfs and for configuring 1655 * for adding the device files to sysfs and for configuring
@@ -1660,13 +1663,11 @@ int usb_new_device(struct usb_device *udev)
1660 1663
1661 /* put device-specific files into sysfs */ 1664 /* put device-specific files into sysfs */
1662 usb_create_sysfs_dev_files(udev); 1665 usb_create_sysfs_dev_files(udev);
1663
1664 /* Tell the world! */
1665 announce_device(udev);
1666 return err; 1666 return err;
1667 1667
1668fail: 1668fail:
1669 usb_set_device_state(udev, USB_STATE_NOTATTACHED); 1669 usb_set_device_state(udev, USB_STATE_NOTATTACHED);
1670 usb_stop_pm(udev);
1670 return err; 1671 return err;
1671} 1672}
1672 1673