summaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ohci-hcd.c
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2012-10-08 15:11:27 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-22 11:23:59 -0700
commitcd1965db054eeace344487b9c8560439961f5f55 (patch)
treef2bdb65754d668e92b37f1adf2e357b58451f743 /drivers/usb/host/ohci-hcd.c
parent2b16e39ee0a431d6cf6e6ca33bb08ec7dc82073f (diff)
downloadlinux-cd1965db054eeace344487b9c8560439961f5f55.tar.bz2
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-hcd.c')
-rw-r--r--drivers/usb/host/ohci-hcd.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 4c4d652a4468..1382689b31db 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1011,6 +1011,49 @@ static int ohci_restart (struct ohci_hcd *ohci)
#endif
+#ifdef CONFIG_PM
+
+static int __maybe_unused ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
+{
+ struct ohci_hcd *ohci = hcd_to_ohci (hcd);
+ unsigned long flags;
+ int rc = 0;
+
+ /* Root hub was already suspended. Disable irq emission and
+ * mark HW unaccessible, bail out if RH has been resumed. Use
+ * the spinlock to properly synchronize with possible pending
+ * RH suspend or resume activity.
+ */
+ spin_lock_irqsave (&ohci->lock, flags);
+ if (ohci->rh_state != OHCI_RH_SUSPENDED) {
+ rc = -EINVAL;
+ goto bail;
+ }
+ ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
+ (void)ohci_readl(ohci, &ohci->regs->intrdisable);
+
+ clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+ bail:
+ spin_unlock_irqrestore (&ohci->lock, flags);
+
+ return rc;
+}
+
+
+static int __maybe_unused ohci_resume(struct usb_hcd *hcd, bool hibernated)
+{
+ set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+
+ /* Make sure resume from hibernation re-enumerates everything */
+ if (hibernated)
+ ohci_usb_reset(hcd_to_ohci(hcd));
+
+ ohci_finish_controller_resume(hcd);
+ return 0;
+}
+
+#endif
+
/*-------------------------------------------------------------------------*/
MODULE_AUTHOR (DRIVER_AUTHOR);