aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-04-03 18:03:06 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-25 00:16:48 -0400
commit7be7d7418776a41badce7ca00246e270d408e4b9 (patch)
tree8d3de8a987f917ceb347b9e4c9e14eebbf6b8f61
parent7329e211b987a493cbcfca0e98c60eb108ab42df (diff)
USB: clarify usage of hcd->suspend/resume methods
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>
-rw-r--r--drivers/usb/core/hcd-pci.c10
-rw-r--r--drivers/usb/core/hcd.h4
-rw-r--r--drivers/usb/host/ehci-pci.c4
-rw-r--r--drivers/usb/host/ohci-pci.c5
-rw-r--r--drivers/usb/host/ohci-ssb.c35
-rw-r--r--drivers/usb/host/u132-hcd.c32
-rw-r--r--drivers/usb/host/uhci-hcd.c8
7 files changed, 15 insertions, 83 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 739407bb8492..5b87ae7f0a6a 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -215,9 +215,9 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
215 hcd->state == HC_STATE_HALT)) 215 hcd->state == HC_STATE_HALT))
216 return -EBUSY; 216 return -EBUSY;
217 217
218 if (hcd->driver->suspend) { 218 if (hcd->driver->pci_suspend) {
219 retval = hcd->driver->suspend(hcd, message); 219 retval = hcd->driver->pci_suspend(hcd, message);
220 suspend_report_result(hcd->driver->suspend, retval); 220 suspend_report_result(hcd->driver->pci_suspend, retval);
221 if (retval) 221 if (retval)
222 goto done; 222 goto done;
223 } 223 }
@@ -405,8 +405,8 @@ int usb_hcd_pci_resume(struct pci_dev *dev)
405 405
406 clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); 406 clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
407 407
408 if (hcd->driver->resume) { 408 if (hcd->driver->pci_resume) {
409 retval = hcd->driver->resume(hcd); 409 retval = hcd->driver->pci_resume(hcd);
410 if (retval) { 410 if (retval) {
411 dev_err(hcd->self.controller, 411 dev_err(hcd->self.controller,
412 "PCI post-resume error %d!\n", retval); 412 "PCI post-resume error %d!\n", retval);
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index e0e99471c3fc..3ba258eb05de 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -178,10 +178,10 @@ struct hc_driver {
178 * a whole, not just the root hub; they're for PCI bus glue. 178 * a whole, not just the root hub; they're for PCI bus glue.
179 */ 179 */
180 /* called after suspending the hub, before entering D3 etc */ 180 /* called after suspending the hub, before entering D3 etc */
181 int (*suspend) (struct usb_hcd *hcd, pm_message_t message); 181 int (*pci_suspend) (struct usb_hcd *hcd, pm_message_t message);
182 182
183 /* called after entering D0 (etc), before resuming the hub */ 183 /* called after entering D0 (etc), before resuming the hub */
184 int (*resume) (struct usb_hcd *hcd); 184 int (*pci_resume) (struct usb_hcd *hcd);
185 185
186 /* cleanly make HCD stop writing memory and doing I/O */ 186 /* cleanly make HCD stop writing memory and doing I/O */
187 void (*stop) (struct usb_hcd *hcd); 187 void (*stop) (struct usb_hcd *hcd);
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 7c8a2ccf78f1..a0afc78b273e 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -353,8 +353,8 @@ static const struct hc_driver ehci_pci_hc_driver = {
353 .reset = ehci_pci_setup, 353 .reset = ehci_pci_setup,
354 .start = ehci_run, 354 .start = ehci_run,
355#ifdef CONFIG_PM 355#ifdef CONFIG_PM
356 .suspend = ehci_pci_suspend, 356 .pci_suspend = ehci_pci_suspend,
357 .resume = ehci_pci_resume, 357 .pci_resume = ehci_pci_resume,
358#endif 358#endif
359 .stop = ehci_stop, 359 .stop = ehci_stop,
360 .shutdown = ehci_shutdown, 360 .shutdown = ehci_shutdown,
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index b0e2275755c8..40b62a35fd3c 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -347,9 +347,8 @@ static const struct hc_driver ohci_pci_hc_driver = {
347 .shutdown = ohci_shutdown, 347 .shutdown = ohci_shutdown,
348 348
349#ifdef CONFIG_PM 349#ifdef CONFIG_PM
350 /* these suspend/resume entries are for upstream PCI glue ONLY */ 350 .pci_suspend = ohci_pci_suspend,
351 .suspend = ohci_pci_suspend, 351 .pci_resume = ohci_pci_resume,
352 .resume = ohci_pci_resume,
353#endif 352#endif
354 353
355 /* 354 /*
diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c
index 6e9c2d6db887..7879f2fdad84 100644
--- a/drivers/usb/host/ohci-ssb.c
+++ b/drivers/usb/host/ohci-ssb.c
@@ -60,36 +60,6 @@ static int ssb_ohci_start(struct usb_hcd *hcd)
60 return err; 60 return err;
61} 61}
62 62
63#ifdef CONFIG_PM
64static int ssb_ohci_hcd_suspend(struct usb_hcd *hcd, pm_message_t message)
65{
66 struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
67 struct ohci_hcd *ohci = &ohcidev->ohci;
68 unsigned long flags;
69
70 spin_lock_irqsave(&ohci->lock, flags);
71
72 ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
73 ohci_readl(ohci, &ohci->regs->intrdisable); /* commit write */
74
75 /* make sure snapshot being resumed re-enumerates everything */
76 if (message.event == PM_EVENT_PRETHAW)
77 ohci_usb_reset(ohci);
78
79 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
80
81 spin_unlock_irqrestore(&ohci->lock, flags);
82 return 0;
83}
84
85static int ssb_ohci_hcd_resume(struct usb_hcd *hcd)
86{
87 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
88 usb_hcd_resume_root_hub(hcd);
89 return 0;
90}
91#endif /* CONFIG_PM */
92
93static const struct hc_driver ssb_ohci_hc_driver = { 63static const struct hc_driver ssb_ohci_hc_driver = {
94 .description = "ssb-usb-ohci", 64 .description = "ssb-usb-ohci",
95 .product_desc = "SSB OHCI Controller", 65 .product_desc = "SSB OHCI Controller",
@@ -103,11 +73,6 @@ static const struct hc_driver ssb_ohci_hc_driver = {
103 .stop = ohci_stop, 73 .stop = ohci_stop,
104 .shutdown = ohci_shutdown, 74 .shutdown = ohci_shutdown,
105 75
106#ifdef CONFIG_PM
107 .suspend = ssb_ohci_hcd_suspend,
108 .resume = ssb_ohci_hcd_resume,
109#endif
110
111 .urb_enqueue = ohci_urb_enqueue, 76 .urb_enqueue = ohci_urb_enqueue,
112 .urb_dequeue = ohci_urb_dequeue, 77 .urb_dequeue = ohci_urb_dequeue,
113 .endpoint_disable = ohci_endpoint_disable, 78 .endpoint_disable = ohci_endpoint_disable,
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 4616a880d89c..9b6323f768b2 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -2946,34 +2946,6 @@ static void u132_hub_irq_enable(struct usb_hcd *hcd)
2946 2946
2947 2947
2948#ifdef CONFIG_PM 2948#ifdef CONFIG_PM
2949static int u132_hcd_suspend(struct usb_hcd *hcd, pm_message_t message)
2950{
2951 struct u132 *u132 = hcd_to_u132(hcd);
2952 if (u132->going > 1) {
2953 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
2954 , u132->going);
2955 return -ENODEV;
2956 } else if (u132->going > 0) {
2957 dev_err(&u132->platform_dev->dev, "device is being removed\n");
2958 return -ESHUTDOWN;
2959 } else
2960 return 0;
2961}
2962
2963static int u132_hcd_resume(struct usb_hcd *hcd)
2964{
2965 struct u132 *u132 = hcd_to_u132(hcd);
2966 if (u132->going > 1) {
2967 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
2968 , u132->going);
2969 return -ENODEV;
2970 } else if (u132->going > 0) {
2971 dev_err(&u132->platform_dev->dev, "device is being removed\n");
2972 return -ESHUTDOWN;
2973 } else
2974 return 0;
2975}
2976
2977static int u132_bus_suspend(struct usb_hcd *hcd) 2949static int u132_bus_suspend(struct usb_hcd *hcd)
2978{ 2950{
2979 struct u132 *u132 = hcd_to_u132(hcd); 2951 struct u132 *u132 = hcd_to_u132(hcd);
@@ -3003,8 +2975,6 @@ static int u132_bus_resume(struct usb_hcd *hcd)
3003} 2975}
3004 2976
3005#else 2977#else
3006#define u132_hcd_suspend NULL
3007#define u132_hcd_resume NULL
3008#define u132_bus_suspend NULL 2978#define u132_bus_suspend NULL
3009#define u132_bus_resume NULL 2979#define u132_bus_resume NULL
3010#endif 2980#endif
@@ -3015,8 +2985,6 @@ static struct hc_driver u132_hc_driver = {
3015 .flags = HCD_USB11 | HCD_MEMORY, 2985 .flags = HCD_USB11 | HCD_MEMORY,
3016 .reset = u132_hcd_reset, 2986 .reset = u132_hcd_reset,
3017 .start = u132_hcd_start, 2987 .start = u132_hcd_start,
3018 .suspend = u132_hcd_suspend,
3019 .resume = u132_hcd_resume,
3020 .stop = u132_hcd_stop, 2988 .stop = u132_hcd_stop,
3021 .urb_enqueue = u132_urb_enqueue, 2989 .urb_enqueue = u132_urb_enqueue,
3022 .urb_dequeue = u132_urb_dequeue, 2990 .urb_dequeue = u132_urb_dequeue,
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index ec987897b8ed..fec9872dd9dc 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -737,7 +737,7 @@ static int uhci_rh_resume(struct usb_hcd *hcd)
737 return rc; 737 return rc;
738} 738}
739 739
740static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message) 740static int uhci_pci_suspend(struct usb_hcd *hcd, pm_message_t message)
741{ 741{
742 struct uhci_hcd *uhci = hcd_to_uhci(hcd); 742 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
743 int rc = 0; 743 int rc = 0;
@@ -774,7 +774,7 @@ done:
774 return rc; 774 return rc;
775} 775}
776 776
777static int uhci_resume(struct usb_hcd *hcd) 777static int uhci_pci_resume(struct usb_hcd *hcd)
778{ 778{
779 struct uhci_hcd *uhci = hcd_to_uhci(hcd); 779 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
780 780
@@ -872,8 +872,8 @@ static const struct hc_driver uhci_driver = {
872 .reset = uhci_init, 872 .reset = uhci_init,
873 .start = uhci_start, 873 .start = uhci_start,
874#ifdef CONFIG_PM 874#ifdef CONFIG_PM
875 .suspend = uhci_suspend, 875 .pci_suspend = uhci_pci_suspend,
876 .resume = uhci_resume, 876 .pci_resume = uhci_pci_resume,
877 .bus_suspend = uhci_rh_suspend, 877 .bus_suspend = uhci_rh_suspend,
878 .bus_resume = uhci_rh_resume, 878 .bus_resume = uhci_rh_resume,
879#endif 879#endif