aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/driver.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index affbfb53eb5e..a5d11461f5a9 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -761,8 +761,12 @@ static int suspend_device(struct usb_device *udev, pm_message_t msg)
761 udev->state == USB_STATE_SUSPENDED) 761 udev->state == USB_STATE_SUSPENDED)
762 goto done; 762 goto done;
763 763
764 if (udev->dev.driver == NULL) 764 /* For devices that don't have a driver, we do a standard suspend. */
765 if (udev->dev.driver == NULL) {
766 status = usb_port_suspend(udev);
765 goto done; 767 goto done;
768 }
769
766 udriver = to_usb_device_driver(udev->dev.driver); 770 udriver = to_usb_device_driver(udev->dev.driver);
767 status = udriver->suspend(udev, msg); 771 status = udriver->suspend(udev, msg);
768 772
@@ -782,8 +786,12 @@ static int resume_device(struct usb_device *udev)
782 udev->state != USB_STATE_SUSPENDED) 786 udev->state != USB_STATE_SUSPENDED)
783 goto done; 787 goto done;
784 788
785 if (udev->dev.driver == NULL) 789 /* Can't resume it if it doesn't have a driver. */
790 if (udev->dev.driver == NULL) {
791 status = -ENOTCONN;
786 goto done; 792 goto done;
793 }
794
787 udriver = to_usb_device_driver(udev->dev.driver); 795 udriver = to_usb_device_driver(udev->dev.driver);
788 status = udriver->resume(udev); 796 status = udriver->resume(udev);
789 797
@@ -804,7 +812,7 @@ static int suspend_interface(struct usb_interface *intf, pm_message_t msg)
804 !is_active(intf)) 812 !is_active(intf))
805 goto done; 813 goto done;
806 814
807 if (intf->dev.driver == NULL) 815 if (intf->dev.driver == NULL) /* This can't happen */
808 goto done; 816 goto done;
809 driver = to_usb_driver(intf->dev.driver); 817 driver = to_usb_driver(intf->dev.driver);
810 818
@@ -838,8 +846,11 @@ static int resume_interface(struct usb_interface *intf)
838 is_active(intf)) 846 is_active(intf))
839 goto done; 847 goto done;
840 848
841 if (intf->dev.driver == NULL) 849 /* Can't resume it if it doesn't have a driver. */
850 if (intf->dev.driver == NULL) {
851 status = -ENOTCONN;
842 goto done; 852 goto done;
853 }
843 driver = to_usb_driver(intf->dev.driver); 854 driver = to_usb_driver(intf->dev.driver);
844 855
845 if (driver->resume) { 856 if (driver->resume) {