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>
This commit is contained in:
Родитель
f150fa1afb
Коммит
6cd132015d
|
@ -1636,6 +1636,10 @@ int usb_new_device(struct usb_device *udev)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
/* Increment the parent's count of unsuspended children */
|
||||||
|
if (udev->parent)
|
||||||
|
usb_autoresume_device(udev->parent);
|
||||||
|
|
||||||
usb_detect_quirks(udev); /* Determine quirks */
|
usb_detect_quirks(udev); /* Determine quirks */
|
||||||
err = usb_configure_device(udev); /* detect & probe dev/intfs */
|
err = usb_configure_device(udev); /* detect & probe dev/intfs */
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
@ -1644,9 +1648,8 @@ int usb_new_device(struct usb_device *udev)
|
||||||
udev->dev.devt = MKDEV(USB_DEVICE_MAJOR,
|
udev->dev.devt = MKDEV(USB_DEVICE_MAJOR,
|
||||||
(((udev->bus->busnum-1) * 128) + (udev->devnum-1)));
|
(((udev->bus->busnum-1) * 128) + (udev->devnum-1)));
|
||||||
|
|
||||||
/* Increment the parent's count of unsuspended children */
|
/* Tell the world! */
|
||||||
if (udev->parent)
|
announce_device(udev);
|
||||||
usb_autoresume_device(udev->parent);
|
|
||||||
|
|
||||||
/* Register the device. The device driver is responsible
|
/* Register the device. The device driver is responsible
|
||||||
* for adding the device files to sysfs and for configuring
|
* for adding the device files to sysfs and for configuring
|
||||||
|
@ -1660,13 +1663,11 @@ int usb_new_device(struct usb_device *udev)
|
||||||
|
|
||||||
/* put device-specific files into sysfs */
|
/* put device-specific files into sysfs */
|
||||||
usb_create_sysfs_dev_files(udev);
|
usb_create_sysfs_dev_files(udev);
|
||||||
|
|
||||||
/* Tell the world! */
|
|
||||||
announce_device(udev);
|
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
usb_set_device_state(udev, USB_STATE_NOTATTACHED);
|
usb_set_device_state(udev, USB_STATE_NOTATTACHED);
|
||||||
|
usb_stop_pm(udev);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче