]> err.no Git - linux-2.6/commitdiff
[PATCH] all HCDs provide root hub suspend/resume methods
authorDavid Brownell <david-b@pacbell.net>
Fri, 23 Sep 2005 05:32:11 +0000 (22:32 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 28 Oct 2005 23:47:40 +0000 (16:47 -0700)
This cleans up a small recent FIXME, ensuring that all the HCDs provide
root hub suspend/resume methods.  It also wraps the calls to those root
suspend routines just like on the PCI "USB_SUSPEND not defined" cases,
so non-PCI bus glue won't be as tempted to behave very differently.

Several of the SOC based OHCI drivers forgot to list those methods;
the patch also adds those missing declarations.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
 drivers/usb/core/hcd.c          |   42 +++++++++++++++++++++++++---------------
 drivers/usb/host/ohci-au1xxx.c  |    5 ++++
 drivers/usb/host/ohci-lh7a404.c |    5 ++++
 drivers/usb/host/ohci-pxa27x.c  |    1
 drivers/usb/host/ohci-s3c2410.c |    1
 drivers/usb/host/ohci-sa1111.c  |    1
 6 files changed, 40 insertions(+), 15 deletions(-)

drivers/usb/core/hcd.c
drivers/usb/host/ohci-au1xxx.c
drivers/usb/host/ohci-lh7a404.c
drivers/usb/host/ohci-pxa27x.c
drivers/usb/host/ohci-s3c2410.c
drivers/usb/host/ohci-sa1111.c

index 5e8ade07d7f9d59bf43224b8835aaa191348642a..375382f9d6712dedf939abe0ed9c426fa6805bb4 100644 (file)
@@ -1431,28 +1431,44 @@ rescan:
 
 /*-------------------------------------------------------------------------*/
 
-/* FIXME make this #ifdef CONFIG_PM ... update root hubs, retest */
-
-#ifdef CONFIG_USB_SUSPEND
+#ifdef CONFIG_PM
 
 static int hcd_hub_suspend (struct usb_bus *bus)
 {
        struct usb_hcd          *hcd;
+       int                     status;
 
        hcd = container_of (bus, struct usb_hcd, self);
-       if (hcd->driver->hub_suspend)
-               return hcd->driver->hub_suspend (hcd);
-       return 0;
+       if (!hcd->driver->hub_suspend)
+               return -ENOENT;
+       hcd->state = HC_STATE_QUIESCING;
+       status = hcd->driver->hub_suspend (hcd);
+       if (status == 0)
+               hcd->state = HC_STATE_SUSPENDED;
+       else
+               dev_dbg(&bus->root_hub->dev, "%s fail, err %d\n",
+                               "suspend", status);
+       return status;
 }
 
 static int hcd_hub_resume (struct usb_bus *bus)
 {
        struct usb_hcd          *hcd;
+       int                     status;
 
        hcd = container_of (bus, struct usb_hcd, self);
-       if (hcd->driver->hub_resume)
-               return hcd->driver->hub_resume (hcd);
-       return 0;
+       if (!hcd->driver->hub_resume)
+               return -ENOENT;
+       hcd->state = HC_STATE_RESUMING;
+       status = hcd->driver->hub_resume (hcd);
+       if (status == 0)
+               hcd->state = HC_STATE_RUNNING;
+       else {
+               dev_dbg(&bus->root_hub->dev, "%s fail, err %d\n",
+                               "resume", status);
+               usb_hc_died(hcd);
+       }
+       return status;
 }
 
 /**
@@ -1473,13 +1489,9 @@ void usb_hcd_resume_root_hub (struct usb_hcd *hcd)
                usb_resume_root_hub (hcd->self.root_hub);
        spin_unlock_irqrestore (&hcd_root_hub_lock, flags);
 }
+EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub);
 
-#else
-void usb_hcd_resume_root_hub (struct usb_hcd *hcd)
-{
-}
 #endif
-EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub);
 
 /*-------------------------------------------------------------------------*/
 
@@ -1532,7 +1544,7 @@ static struct usb_operations usb_hcd_operations = {
        .buffer_alloc =         hcd_buffer_alloc,
        .buffer_free =          hcd_buffer_free,
        .disable =              hcd_endpoint_disable,
-#ifdef CONFIG_USB_SUSPEND
+#ifdef CONFIG_PM
        .hub_suspend =          hcd_hub_suspend,
        .hub_resume =           hcd_hub_resume,
 #endif
index 3981bf15c8c72a7db18958512254bef3e9f10eed..550d67a554f6583ac39d876309d0c44a10534b28 100644 (file)
@@ -214,6 +214,11 @@ static const struct hc_driver ohci_au1xxx_hc_driver = {
         */
        .hub_status_data =      ohci_hub_status_data,
        .hub_control =          ohci_hub_control,
+#ifdef CONFIG_PM
+       .hub_suspend =          ohci_hub_suspend,
+       .hub_resume =           ohci_hub_resume,
+#endif
+       .start_port_reset =     ohci_start_port_reset,
 };
 
 /*-------------------------------------------------------------------------*/
index 859aca7be753bf6dfbc209e0bf19497834262e7a..71d975ae78bd30e8673f37117d75e338847426d8 100644 (file)
@@ -193,6 +193,11 @@ static const struct hc_driver ohci_lh7a404_hc_driver = {
         */
        .hub_status_data =      ohci_hub_status_data,
        .hub_control =          ohci_hub_control,
+#ifdef CONFIG_PM
+       .hub_suspend =          ohci_hub_suspend,
+       .hub_resume =           ohci_hub_resume,
+#endif
+       .start_port_reset =     ohci_start_port_reset,
 };
 
 /*-------------------------------------------------------------------------*/
index 986c4f656e224c3f21fca77e36dc1039cb5b9019..2e7b48502a3d28406b43c0839e1e48cfe991424e 100644 (file)
@@ -282,6 +282,7 @@ static const struct hc_driver ohci_pxa27x_hc_driver = {
        .hub_suspend =          ohci_hub_suspend,
        .hub_resume =           ohci_hub_resume,
 #endif
+       .start_port_reset =     ohci_start_port_reset,
 };
 
 /*-------------------------------------------------------------------------*/
index 8cf12b2be2a35c4c3c40c01e9fb152c9fc908040..922e2a6f46ef5d54ae54b9ce4612deaf9857e270 100644 (file)
@@ -452,6 +452,7 @@ static const struct hc_driver ohci_s3c2410_hc_driver = {
        .hub_suspend =          ohci_hub_suspend,
        .hub_resume =           ohci_hub_resume,
 #endif
+       .start_port_reset =     ohci_start_port_reset,
 };
 
 /* device driver */
index 7dd1f410b7f104a9e3b13dc8e3bb834c9421adac..13324b7f9c59a40b633525577c9eec8af4b81ec4 100644 (file)
@@ -239,6 +239,7 @@ static const struct hc_driver ohci_sa1111_hc_driver = {
        .hub_suspend =          ohci_hub_suspend,
        .hub_resume =           ohci_hub_resume,
 #endif
+       .start_port_reset =     ohci_start_port_reset,
 };
 
 /*-------------------------------------------------------------------------*/