Commit 7be7d741 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7329e211
...@@ -215,9 +215,9 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message) ...@@ -215,9 +215,9 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
hcd->state == HC_STATE_HALT)) hcd->state == HC_STATE_HALT))
return -EBUSY; return -EBUSY;
if (hcd->driver->suspend) { if (hcd->driver->pci_suspend) {
retval = hcd->driver->suspend(hcd, message); retval = hcd->driver->pci_suspend(hcd, message);
suspend_report_result(hcd->driver->suspend, retval); suspend_report_result(hcd->driver->pci_suspend, retval);
if (retval) if (retval)
goto done; goto done;
} }
...@@ -405,8 +405,8 @@ int usb_hcd_pci_resume(struct pci_dev *dev) ...@@ -405,8 +405,8 @@ int usb_hcd_pci_resume(struct pci_dev *dev)
clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
if (hcd->driver->resume) { if (hcd->driver->pci_resume) {
retval = hcd->driver->resume(hcd); retval = hcd->driver->pci_resume(hcd);
if (retval) { if (retval) {
dev_err(hcd->self.controller, dev_err(hcd->self.controller,
"PCI post-resume error %d!\n", retval); "PCI post-resume error %d!\n", retval);
......
...@@ -178,10 +178,10 @@ struct hc_driver { ...@@ -178,10 +178,10 @@ struct hc_driver {
* a whole, not just the root hub; they're for PCI bus glue. * a whole, not just the root hub; they're for PCI bus glue.
*/ */
/* called after suspending the hub, before entering D3 etc */ /* 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 */ /* 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 */ /* cleanly make HCD stop writing memory and doing I/O */
void (*stop) (struct usb_hcd *hcd); void (*stop) (struct usb_hcd *hcd);
......
...@@ -353,8 +353,8 @@ static const struct hc_driver ehci_pci_hc_driver = { ...@@ -353,8 +353,8 @@ static const struct hc_driver ehci_pci_hc_driver = {
.reset = ehci_pci_setup, .reset = ehci_pci_setup,
.start = ehci_run, .start = ehci_run,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = ehci_pci_suspend, .pci_suspend = ehci_pci_suspend,
.resume = ehci_pci_resume, .pci_resume = ehci_pci_resume,
#endif #endif
.stop = ehci_stop, .stop = ehci_stop,
.shutdown = ehci_shutdown, .shutdown = ehci_shutdown,
......
...@@ -347,9 +347,8 @@ static const struct hc_driver ohci_pci_hc_driver = { ...@@ -347,9 +347,8 @@ static const struct hc_driver ohci_pci_hc_driver = {
.shutdown = ohci_shutdown, .shutdown = ohci_shutdown,
#ifdef CONFIG_PM #ifdef CONFIG_PM
/* these suspend/resume entries are for upstream PCI glue ONLY */ .pci_suspend = ohci_pci_suspend,
.suspend = ohci_pci_suspend, .pci_resume = ohci_pci_resume,
.resume = ohci_pci_resume,
#endif #endif
/* /*
......
...@@ -60,36 +60,6 @@ static int ssb_ohci_start(struct usb_hcd *hcd) ...@@ -60,36 +60,6 @@ static int ssb_ohci_start(struct usb_hcd *hcd)
return err; 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 = { static const struct hc_driver ssb_ohci_hc_driver = {
.description = "ssb-usb-ohci", .description = "ssb-usb-ohci",
.product_desc = "SSB OHCI Controller", .product_desc = "SSB OHCI Controller",
...@@ -103,11 +73,6 @@ static const struct hc_driver ssb_ohci_hc_driver = { ...@@ -103,11 +73,6 @@ static const struct hc_driver ssb_ohci_hc_driver = {
.stop = ohci_stop, .stop = ohci_stop,
.shutdown = ohci_shutdown, .shutdown = ohci_shutdown,
#ifdef CONFIG_PM
.suspend = ssb_ohci_hcd_suspend,
.resume = ssb_ohci_hcd_resume,
#endif
.urb_enqueue = ohci_urb_enqueue, .urb_enqueue = ohci_urb_enqueue,
.urb_dequeue = ohci_urb_dequeue, .urb_dequeue = ohci_urb_dequeue,
.endpoint_disable = ohci_endpoint_disable, .endpoint_disable = ohci_endpoint_disable,
......
...@@ -2946,34 +2946,6 @@ static void u132_hub_irq_enable(struct usb_hcd *hcd) ...@@ -2946,34 +2946,6 @@ static void u132_hub_irq_enable(struct usb_hcd *hcd)
#ifdef CONFIG_PM #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) static int u132_bus_suspend(struct usb_hcd *hcd)
{ {
struct u132 *u132 = hcd_to_u132(hcd); struct u132 *u132 = hcd_to_u132(hcd);
...@@ -3003,8 +2975,6 @@ static int u132_bus_resume(struct usb_hcd *hcd) ...@@ -3003,8 +2975,6 @@ static int u132_bus_resume(struct usb_hcd *hcd)
} }
#else #else
#define u132_hcd_suspend NULL
#define u132_hcd_resume NULL
#define u132_bus_suspend NULL #define u132_bus_suspend NULL
#define u132_bus_resume NULL #define u132_bus_resume NULL
#endif #endif
...@@ -3015,8 +2985,6 @@ static struct hc_driver u132_hc_driver = { ...@@ -3015,8 +2985,6 @@ static struct hc_driver u132_hc_driver = {
.flags = HCD_USB11 | HCD_MEMORY, .flags = HCD_USB11 | HCD_MEMORY,
.reset = u132_hcd_reset, .reset = u132_hcd_reset,
.start = u132_hcd_start, .start = u132_hcd_start,
.suspend = u132_hcd_suspend,
.resume = u132_hcd_resume,
.stop = u132_hcd_stop, .stop = u132_hcd_stop,
.urb_enqueue = u132_urb_enqueue, .urb_enqueue = u132_urb_enqueue,
.urb_dequeue = u132_urb_dequeue, .urb_dequeue = u132_urb_dequeue,
......
...@@ -737,7 +737,7 @@ static int uhci_rh_resume(struct usb_hcd *hcd) ...@@ -737,7 +737,7 @@ static int uhci_rh_resume(struct usb_hcd *hcd)
return rc; 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); struct uhci_hcd *uhci = hcd_to_uhci(hcd);
int rc = 0; int rc = 0;
...@@ -774,7 +774,7 @@ static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message) ...@@ -774,7 +774,7 @@ static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message)
return rc; 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); struct uhci_hcd *uhci = hcd_to_uhci(hcd);
...@@ -872,8 +872,8 @@ static const struct hc_driver uhci_driver = { ...@@ -872,8 +872,8 @@ static const struct hc_driver uhci_driver = {
.reset = uhci_init, .reset = uhci_init,
.start = uhci_start, .start = uhci_start,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = uhci_suspend, .pci_suspend = uhci_pci_suspend,
.resume = uhci_resume, .pci_resume = uhci_pci_resume,
.bus_suspend = uhci_rh_suspend, .bus_suspend = uhci_rh_suspend,
.bus_resume = uhci_rh_resume, .bus_resume = uhci_rh_resume,
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment