aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/hub.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-07-09 16:34:25 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-09 16:34:25 -0400
commitf974a8ec96571535ee07880a023bcce0e3f2c76b (patch)
tree5cf09207b1ad292a55275cd0b24999fa29b9dfe8 /drivers/usb/core/hub.c
parentc0b8556f2f8146bd38324b14b1ce00f249ba8ed9 (diff)
parent4ed47896935573c8423d05bddda3f269d6e6c613 (diff)
Merge branch 'machtypes' into pxa-palm
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r--drivers/usb/core/hub.c61
1 files changed, 58 insertions, 3 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index eb57fcc701d7..94789be54ca3 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -644,6 +644,48 @@ static void hub_stop(struct usb_hub *hub)
644 644
645#ifdef CONFIG_PM 645#ifdef CONFIG_PM
646 646
647/* Try to identify which devices need USB-PERSIST handling */
648static int persistent_device(struct usb_device *udev)
649{
650 int i;
651 int retval;
652 struct usb_host_config *actconfig;
653
654 /* Explicitly not marked persistent? */
655 if (!udev->persist_enabled)
656 return 0;
657
658 /* No active config? */
659 actconfig = udev->actconfig;
660 if (!actconfig)
661 return 0;
662
663 /* FIXME! We should check whether it's open here or not! */
664
665 /*
666 * Check that all the interface drivers have a
667 * 'reset_resume' entrypoint
668 */
669 retval = 0;
670 for (i = 0; i < actconfig->desc.bNumInterfaces; i++) {
671 struct usb_interface *intf;
672 struct usb_driver *driver;
673
674 intf = actconfig->interface[i];
675 if (!intf->dev.driver)
676 continue;
677 driver = to_usb_driver(intf->dev.driver);
678 if (!driver->reset_resume)
679 return 0;
680 /*
681 * We have at least one driver, and that one
682 * has a reset_resume method.
683 */
684 retval = 1;
685 }
686 return retval;
687}
688
647static void hub_restart(struct usb_hub *hub, int type) 689static void hub_restart(struct usb_hub *hub, int type)
648{ 690{
649 struct usb_device *hdev = hub->hdev; 691 struct usb_device *hdev = hub->hdev;
@@ -689,8 +731,8 @@ static void hub_restart(struct usb_hub *hub, int type)
689 * turn off the various status changes to prevent 731 * turn off the various status changes to prevent
690 * khubd from disconnecting it later. 732 * khubd from disconnecting it later.
691 */ 733 */
692 if (udev->persist_enabled && status == 0 && 734 if (status == 0 && !(portstatus & USB_PORT_STAT_ENABLE) &&
693 !(portstatus & USB_PORT_STAT_ENABLE)) { 735 persistent_device(udev)) {
694 if (portchange & USB_PORT_STAT_C_ENABLE) 736 if (portchange & USB_PORT_STAT_C_ENABLE)
695 clear_port_feature(hub->hdev, port1, 737 clear_port_feature(hub->hdev, port1,
696 USB_PORT_FEAT_C_ENABLE); 738 USB_PORT_FEAT_C_ENABLE);
@@ -1326,6 +1368,12 @@ void usb_disconnect(struct usb_device **pdev)
1326 1368
1327 usb_unlock_device(udev); 1369 usb_unlock_device(udev);
1328 1370
1371 /* Remove the device-specific files from sysfs. This must be
1372 * done with udev unlocked, because some of the attribute
1373 * routines try to acquire the device lock.
1374 */
1375 usb_remove_sysfs_dev_files(udev);
1376
1329 /* Unregister the device. The device driver is responsible 1377 /* Unregister the device. The device driver is responsible
1330 * for removing the device files from usbfs and sysfs and for 1378 * for removing the device files from usbfs and sysfs and for
1331 * de-configuring the device. 1379 * de-configuring the device.
@@ -1541,6 +1589,9 @@ int usb_new_device(struct usb_device *udev)
1541 goto fail; 1589 goto fail;
1542 } 1590 }
1543 1591
1592 /* put device-specific files into sysfs */
1593 usb_create_sysfs_dev_files(udev);
1594
1544 /* Tell the world! */ 1595 /* Tell the world! */
1545 announce_device(udev); 1596 announce_device(udev);
1546 return err; 1597 return err;
@@ -2744,7 +2795,11 @@ loop:
2744 if ((status == -ENOTCONN) || (status == -ENOTSUPP)) 2795 if ((status == -ENOTCONN) || (status == -ENOTSUPP))
2745 break; 2796 break;
2746 } 2797 }
2747 dev_err(hub_dev, "unable to enumerate USB device on port %d\n", port1); 2798 if (hub->hdev->parent ||
2799 !hcd->driver->port_handed_over ||
2800 !(hcd->driver->port_handed_over)(hcd, port1))
2801 dev_err(hub_dev, "unable to enumerate USB device on port %d\n",
2802 port1);
2748 2803
2749done: 2804done:
2750 hub_port_disable(hub, port1, 1); 2805 hub_port_disable(hub, port1, 1);