/* if this is only an unbind, not a physical disconnect, then
* unconfigure the device */
- if (udev->state == USB_STATE_CONFIGURED)
+ if (udev->actconfig)
usb_set_configuration(udev, 0);
usb_remove_sysfs_dev_files(udev);
-
- /* in case the call failed or the device was suspended */
- if (udev->state >= USB_STATE_CONFIGURED)
- usb_disable_device(udev, 0);
}
#ifdef CONFIG_PM
-static int verify_suspended(struct device *dev, void *unused)
-{
- if (dev->driver == NULL)
- return 0;
- return (dev->power.power_state.event == PM_EVENT_ON) ? -EBUSY : 0;
-}
-
static int generic_suspend(struct usb_device *udev, pm_message_t msg)
{
- int status;
-
- /* rule out bogus requests through sysfs */
- status = device_for_each_child(&udev->dev, NULL, verify_suspended);
- if (status)
- return status;
-
/* USB devices enter SUSPEND state through their hubs, but can be
* marked for FREEZE as soon as their children are already idled.
* But those semantics are useless, so we equate the two (sigh).
static int generic_resume(struct usb_device *udev)
{
- if (udev->state == USB_STATE_NOTATTACHED)
- return 0;
-
return usb_port_resume(udev);
}
.suspend = generic_suspend,
.resume = generic_resume,
#endif
+ .supports_autosuspend = 1,
};