]> err.no Git - linux-2.6/commitdiff
USB: clarify usage of hcd->suspend/resume methods
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 3 Apr 2008 22:03:06 +0000 (18:03 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Apr 2008 04:16:48 +0000 (21:16 -0700)
The .suspend and .resume method pointers in struct usb_hcd have not
been fully understood by host-controller driver writers.  They are
meant for use with PCI controllers; other platform-specific drivers
generally should not refer to them.

To try and clarify matters, this patch (as1065) renames those methods
to .pci_suspend and .pci_resume.  It eliminates corresponding dead code
and bogus references in the ohci-ssb and u132-hcd drivers.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hcd-pci.c
drivers/usb/core/hcd.h
drivers/usb/host/ehci-pci.c
drivers/usb/host/ohci-pci.c
drivers/usb/host/ohci-ssb.c
drivers/usb/host/u132-hcd.c
drivers/usb/host/uhci-hcd.c

index 739407bb8492b6e29fa9453dc7d18b672a606716..5b87ae7f0a6acc2d2ab7ecf3f7d4a3af2da1915c 100644 (file)
@@ -215,9 +215,9 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
                        hcd->state == HC_STATE_HALT))
                return -EBUSY;
 
-       if (hcd->driver->suspend) {
-               retval = hcd->driver->suspend(hcd, message);
-               suspend_report_result(hcd->driver->suspend, retval);
+       if (hcd->driver->pci_suspend) {
+               retval = hcd->driver->pci_suspend(hcd, message);
+               suspend_report_result(hcd->driver->pci_suspend, retval);
                if (retval)
                        goto done;
        }
@@ -405,8 +405,8 @@ int usb_hcd_pci_resume(struct pci_dev *dev)
 
        clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
 
-       if (hcd->driver->resume) {
-               retval = hcd->driver->resume(hcd);
+       if (hcd->driver->pci_resume) {
+               retval = hcd->driver->pci_resume(hcd);
                if (retval) {
                        dev_err(hcd->self.controller,
                                "PCI post-resume error %d!\n", retval);
index e0e99471c3fca6ba9483012380944c007bcae1e0..3ba258eb05de0bce323796f20752d2779414f735 100644 (file)
@@ -178,10 +178,10 @@ struct hc_driver {
         * a whole, not just the root hub; they're for PCI bus glue.
         */
        /* called after suspending the hub, before entering D3 etc */
-       int     (*suspend) (struct usb_hcd *hcd, pm_message_t message);
+       int     (*pci_suspend) (struct usb_hcd *hcd, pm_message_t message);
 
        /* called after entering D0 (etc), before resuming the hub */
-       int     (*resume) (struct usb_hcd *hcd);
+       int     (*pci_resume) (struct usb_hcd *hcd);
 
        /* cleanly make HCD stop writing memory and doing I/O */
        void    (*stop) (struct usb_hcd *hcd);
index 7c8a2ccf78f1df828b6ed72d3e21d369831394d1..a0afc78b273e2509aa6223aefc1933222315d1ce 100644 (file)
@@ -353,8 +353,8 @@ static const struct hc_driver ehci_pci_hc_driver = {
        .reset =                ehci_pci_setup,
        .start =                ehci_run,
 #ifdef CONFIG_PM
-       .suspend =              ehci_pci_suspend,
-       .resume =               ehci_pci_resume,
+       .pci_suspend =          ehci_pci_suspend,
+       .pci_resume =           ehci_pci_resume,
 #endif
        .stop =                 ehci_stop,
        .shutdown =             ehci_shutdown,
index b0e2275755c82bcdd41f48afed4e4b381e5715f1..40b62a35fd3c66fc2e27d0a3921989ccfed71738 100644 (file)
@@ -347,9 +347,8 @@ static const struct hc_driver ohci_pci_hc_driver = {
        .shutdown =             ohci_shutdown,
 
 #ifdef CONFIG_PM
-       /* these suspend/resume entries are for upstream PCI glue ONLY */
-       .suspend =              ohci_pci_suspend,
-       .resume =               ohci_pci_resume,
+       .pci_suspend =          ohci_pci_suspend,
+       .pci_resume =           ohci_pci_resume,
 #endif
 
        /*
index 6e9c2d6db88756370c5b2f7d9a1bf9cc5d2beabe..7879f2fdad8447eee13dca5ffd50e1499ca4efa8 100644 (file)
@@ -60,36 +60,6 @@ static int ssb_ohci_start(struct usb_hcd *hcd)
        return err;
 }
 
-#ifdef CONFIG_PM
-static int ssb_ohci_hcd_suspend(struct usb_hcd *hcd, pm_message_t message)
-{
-       struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
-       struct ohci_hcd *ohci = &ohcidev->ohci;
-       unsigned long flags;
-
-       spin_lock_irqsave(&ohci->lock, flags);
-
-       ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
-       ohci_readl(ohci, &ohci->regs->intrdisable); /* commit write */
-
-       /* make sure snapshot being resumed re-enumerates everything */
-       if (message.event == PM_EVENT_PRETHAW)
-               ohci_usb_reset(ohci);
-
-       clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
-
-       spin_unlock_irqrestore(&ohci->lock, flags);
-       return 0;
-}
-
-static int ssb_ohci_hcd_resume(struct usb_hcd *hcd)
-{
-       set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
-       usb_hcd_resume_root_hub(hcd);
-       return 0;
-}
-#endif /* CONFIG_PM */
-
 static const struct hc_driver ssb_ohci_hc_driver = {
        .description            = "ssb-usb-ohci",
        .product_desc           = "SSB OHCI Controller",
@@ -103,11 +73,6 @@ static const struct hc_driver ssb_ohci_hc_driver = {
        .stop                   = ohci_stop,
        .shutdown               = ohci_shutdown,
 
-#ifdef CONFIG_PM
-       .suspend                = ssb_ohci_hcd_suspend,
-       .resume                 = ssb_ohci_hcd_resume,
-#endif
-
        .urb_enqueue            = ohci_urb_enqueue,
        .urb_dequeue            = ohci_urb_dequeue,
        .endpoint_disable       = ohci_endpoint_disable,
index 4616a880d89cb5d2ad163c33d3f1086a718a5c16..9b6323f768b242523495d352134f5533c423566d 100644 (file)
@@ -2946,34 +2946,6 @@ static void u132_hub_irq_enable(struct usb_hcd *hcd)
 
 
 #ifdef CONFIG_PM
-static int u132_hcd_suspend(struct usb_hcd *hcd, pm_message_t message)
-{
-       struct u132 *u132 = hcd_to_u132(hcd);
-       if (u132->going > 1) {
-               dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
-                       , u132->going);
-               return -ENODEV;
-       } else if (u132->going > 0) {
-               dev_err(&u132->platform_dev->dev, "device is being removed\n");
-               return -ESHUTDOWN;
-       } else
-               return 0;
-}
-
-static int u132_hcd_resume(struct usb_hcd *hcd)
-{
-       struct u132 *u132 = hcd_to_u132(hcd);
-       if (u132->going > 1) {
-               dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
-                       , u132->going);
-               return -ENODEV;
-       } else if (u132->going > 0) {
-               dev_err(&u132->platform_dev->dev, "device is being removed\n");
-               return -ESHUTDOWN;
-       } else
-               return 0;
-}
-
 static int u132_bus_suspend(struct usb_hcd *hcd)
 {
        struct u132 *u132 = hcd_to_u132(hcd);
@@ -3003,8 +2975,6 @@ static int u132_bus_resume(struct usb_hcd *hcd)
 }
 
 #else
-#define u132_hcd_suspend NULL
-#define u132_hcd_resume NULL
 #define u132_bus_suspend NULL
 #define u132_bus_resume NULL
 #endif
@@ -3015,8 +2985,6 @@ static struct hc_driver u132_hc_driver = {
        .flags = HCD_USB11 | HCD_MEMORY,
        .reset = u132_hcd_reset,
        .start = u132_hcd_start,
-       .suspend = u132_hcd_suspend,
-       .resume = u132_hcd_resume,
        .stop = u132_hcd_stop,
        .urb_enqueue = u132_urb_enqueue,
        .urb_dequeue = u132_urb_dequeue,
index ec987897b8ededd485ac67a0a877a144cb24b39c..fec9872dd9dc83d5bbc90d0d780c1419b67ec009 100644 (file)
@@ -737,7 +737,7 @@ static int uhci_rh_resume(struct usb_hcd *hcd)
        return rc;
 }
 
-static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message)
+static int uhci_pci_suspend(struct usb_hcd *hcd, pm_message_t message)
 {
        struct uhci_hcd *uhci = hcd_to_uhci(hcd);
        int rc = 0;
@@ -774,7 +774,7 @@ done:
        return rc;
 }
 
-static int uhci_resume(struct usb_hcd *hcd)
+static int uhci_pci_resume(struct usb_hcd *hcd)
 {
        struct uhci_hcd *uhci = hcd_to_uhci(hcd);
 
@@ -872,8 +872,8 @@ static const struct hc_driver uhci_driver = {
        .reset =                uhci_init,
        .start =                uhci_start,
 #ifdef CONFIG_PM
-       .suspend =              uhci_suspend,
-       .resume =               uhci_resume,
+       .pci_suspend =          uhci_pci_suspend,
+       .pci_resume =           uhci_pci_resume,
        .bus_suspend =          uhci_rh_suspend,
        .bus_resume =           uhci_rh_resume,
 #endif