diff options
author | Florian Fainelli <florian@openwrt.org> | 2012-10-08 09:11:27 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-22 14:23:59 -0400 |
commit | cd1965db054eeace344487b9c8560439961f5f55 (patch) | |
tree | f2bdb65754d668e92b37f1adf2e357b58451f743 /drivers/usb/host/ohci-pci.c | |
parent | 2b16e39ee0a431d6cf6e6ca33bb08ec7dc82073f (diff) |
USB: ohci: move ohci_pci_{suspend,resume} to ohci-hcd.c
As suggested by Alan Stern, move the ohci-pci.c ohci_pci_{suspend,resume}
routines to ohci-hcd.c. Due to their move, also rename them to
ohci_{suspend,resume} to make it clear they operate on ohci_hcd. Since they
are not necessarily called, annotate them with __maybe_unused, and make them
enclosed within an #ifdef CONFIG_PM / #endif section.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/ohci-pci.c')
-rw-r--r-- | drivers/usb/host/ohci-pci.c | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 1843bb68ac7c..6afa7dc4e4c3 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -296,49 +296,6 @@ static int __devinit ohci_pci_start (struct usb_hcd *hcd) | |||
296 | return ret; | 296 | return ret; |
297 | } | 297 | } |
298 | 298 | ||
299 | #ifdef CONFIG_PM | ||
300 | |||
301 | static int ohci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | ||
302 | { | ||
303 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | ||
304 | unsigned long flags; | ||
305 | int rc = 0; | ||
306 | |||
307 | /* Root hub was already suspended. Disable irq emission and | ||
308 | * mark HW unaccessible, bail out if RH has been resumed. Use | ||
309 | * the spinlock to properly synchronize with possible pending | ||
310 | * RH suspend or resume activity. | ||
311 | */ | ||
312 | spin_lock_irqsave (&ohci->lock, flags); | ||
313 | if (ohci->rh_state != OHCI_RH_SUSPENDED) { | ||
314 | rc = -EINVAL; | ||
315 | goto bail; | ||
316 | } | ||
317 | ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); | ||
318 | (void)ohci_readl(ohci, &ohci->regs->intrdisable); | ||
319 | |||
320 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
321 | bail: | ||
322 | spin_unlock_irqrestore (&ohci->lock, flags); | ||
323 | |||
324 | return rc; | ||
325 | } | ||
326 | |||
327 | |||
328 | static int ohci_pci_resume(struct usb_hcd *hcd, bool hibernated) | ||
329 | { | ||
330 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
331 | |||
332 | /* Make sure resume from hibernation re-enumerates everything */ | ||
333 | if (hibernated) | ||
334 | ohci_usb_reset(hcd_to_ohci(hcd)); | ||
335 | |||
336 | ohci_finish_controller_resume(hcd); | ||
337 | return 0; | ||
338 | } | ||
339 | |||
340 | #endif /* CONFIG_PM */ | ||
341 | |||
342 | 299 | ||
343 | /*-------------------------------------------------------------------------*/ | 300 | /*-------------------------------------------------------------------------*/ |
344 | 301 | ||
@@ -362,8 +319,8 @@ static const struct hc_driver ohci_pci_hc_driver = { | |||
362 | .shutdown = ohci_shutdown, | 319 | .shutdown = ohci_shutdown, |
363 | 320 | ||
364 | #ifdef CONFIG_PM | 321 | #ifdef CONFIG_PM |
365 | .pci_suspend = ohci_pci_suspend, | 322 | .pci_suspend = ohci_suspend, |
366 | .pci_resume = ohci_pci_resume, | 323 | .pci_resume = ohci_resume, |
367 | #endif | 324 | #endif |
368 | 325 | ||
369 | /* | 326 | /* |