USB: ohci: merge ohci_finish_controller_resume with ohci_resume
authorFlorian Fainelli <florian@openwrt.org>
Mon, 8 Oct 2012 13:11:29 +0000 (15:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Oct 2012 18:23:59 +0000 (11:23 -0700)
Merge ohci_finish_controller_resume with ohci_resume as suggested by Alan
Stern. Since ohci_finish_controller_resume no longer exists, update the
various OHCI drivers to call ohci_resume() instead. Some drivers used to set
themselves the bit HCD_FLAG_HW_ACCESSIBLE, which is now handled by
ohci_resume().

Acked-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
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>
drivers/usb/host/ohci-at91.c
drivers/usb/host/ohci-ep93xx.c
drivers/usb/host/ohci-exynos.c
drivers/usb/host/ohci-hcd.c
drivers/usb/host/ohci-hub.c
drivers/usb/host/ohci-omap.c
drivers/usb/host/ohci-platform.c
drivers/usb/host/ohci-pxa27x.c
drivers/usb/host/ohci-s3c2410.c
drivers/usb/host/ohci-spear.c
drivers/usb/host/ohci-tmio.c

index 0bf72f943b00d392654fdc9613e4f397bfac2d32..908d84af1dd72bca08b80f40177dfdecc881bd00 100644 (file)
@@ -705,7 +705,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
        if (!clocked)
                at91_start_clock();
 
-       ohci_finish_controller_resume(hcd);
+       ohci_resume(hcd, false);
        return 0;
 }
 #else
index dbfbd1dfd2e2f798aae4fc60456d2190e47d0428..a982f04ed78705b037af6e91037ebea20a84ab85 100644 (file)
@@ -194,7 +194,7 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
 
        ep93xx_start_hc(&pdev->dev);
 
-       ohci_finish_controller_resume(hcd);
+       ohci_resume(hcd, false);
        return 0;
 }
 #endif
index 20a50081f9225d7111c7a9ddfe3d91dc1f8bde97..929a49437e2e6c95433714ed32f9bb6cb91101ea 100644 (file)
@@ -252,10 +252,7 @@ static int exynos_ohci_resume(struct device *dev)
        if (pdata && pdata->phy_init)
                pdata->phy_init(pdev, S5P_USB_PHY_HOST);
 
-       /* Mark hardware accessible again as we are out of D3 state by now */
-       set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
-
-       ohci_finish_controller_resume(hcd);
+       ohci_resume(hcd, false);
 
        return 0;
 }
index 76663295e1c73052d4e6d2ce0cc347f4f21277b4..bac66263696958175c2e462e5faca12305b1eac4 100644 (file)
@@ -1035,13 +1035,50 @@ static int __maybe_unused ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 
 static int __maybe_unused ohci_resume(struct usb_hcd *hcd, bool hibernated)
 {
+       struct ohci_hcd         *ohci = hcd_to_ohci(hcd);
+       int                     port;
+       bool                    need_reinit = false;
+
        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_usb_reset(ohci);
+
+       /* See if the controller is already running or has been reset */
+       ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
+       if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
+               need_reinit = true;
+       } else {
+               switch (ohci->hc_control & OHCI_CTRL_HCFS) {
+               case OHCI_USB_OPER:
+               case OHCI_USB_RESET:
+                       need_reinit = true;
+               }
+       }
+
+       /* If needed, reinitialize and suspend the root hub */
+       if (need_reinit) {
+               spin_lock_irq(&ohci->lock);
+               ohci_rh_resume(ohci);
+               ohci_rh_suspend(ohci, 0);
+               spin_unlock_irq(&ohci->lock);
+       }
+
+       /* Normally just turn on port power and enable interrupts */
+       else {
+               ohci_dbg(ohci, "powerup ports\n");
+               for (port = 0; port < ohci->num_ports; port++)
+                       ohci_writel(ohci, RH_PS_PPS,
+                                       &ohci->regs->roothub.portstatus[port]);
+
+               ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable);
+               ohci_readl(ohci, &ohci->regs->intrenable);
+               msleep(20);
+       }
+
+       usb_hcd_resume_root_hub(hcd);
 
-       ohci_finish_controller_resume(hcd);
        return 0;
 }
 
index 2f3619eefefa9bca87189e5da44dd6bbb0cd8191..db09dae7b557a18063d424a3ffc58c1edb8ccca8 100644 (file)
@@ -316,48 +316,6 @@ static int ohci_bus_resume (struct usb_hcd *hcd)
        return rc;
 }
 
-/* Carry out the final steps of resuming the controller device */
-static void __maybe_unused ohci_finish_controller_resume(struct usb_hcd *hcd)
-{
-       struct ohci_hcd         *ohci = hcd_to_ohci(hcd);
-       int                     port;
-       bool                    need_reinit = false;
-
-       /* See if the controller is already running or has been reset */
-       ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
-       if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
-               need_reinit = true;
-       } else {
-               switch (ohci->hc_control & OHCI_CTRL_HCFS) {
-               case OHCI_USB_OPER:
-               case OHCI_USB_RESET:
-                       need_reinit = true;
-               }
-       }
-
-       /* If needed, reinitialize and suspend the root hub */
-       if (need_reinit) {
-               spin_lock_irq(&ohci->lock);
-               ohci_rh_resume(ohci);
-               ohci_rh_suspend(ohci, 0);
-               spin_unlock_irq(&ohci->lock);
-       }
-
-       /* Normally just turn on port power and enable interrupts */
-       else {
-               ohci_dbg(ohci, "powerup ports\n");
-               for (port = 0; port < ohci->num_ports; port++)
-                       ohci_writel(ohci, RH_PS_PPS,
-                                       &ohci->regs->roothub.portstatus[port]);
-
-               ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable);
-               ohci_readl(ohci, &ohci->regs->intrenable);
-               msleep(20);
-       }
-
-       usb_hcd_resume_root_hub(hcd);
-}
-
 /* Carry out polling-, autostop-, and autoresume-related state changes */
 static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
                int any_connected, int rhsc_status)
index 4531d03503c32371f4b1c5cd505ac38243dafe13..733c77c36355ac95082ec08cc3ceb4e3c7d9d881 100644 (file)
@@ -530,7 +530,7 @@ static int ohci_omap_resume(struct platform_device *dev)
        ohci->next_statechange = jiffies;
 
        omap_ohci_clock_power(1);
-       ohci_finish_controller_resume(hcd);
+       ohci_resume(hcd, false);
        return 0;
 }
 
index 1caaf657c5ea1cddf7930e0bf72f0b0c74e10ac5..99d17552d8094adc9932c3db184355b3a3fc4084 100644 (file)
@@ -203,7 +203,7 @@ static int ohci_platform_resume(struct device *dev)
                        return err;
        }
 
-       ohci_finish_controller_resume(hcd);
+       ohci_resume(hcd, false);
        return 0;
 }
 
index 2bf11440b010443290f2cbd6795cf22ddf561b0d..156d289d3bb51112b6aad220291101ceafe5e4ff 100644 (file)
@@ -591,7 +591,7 @@ static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
        /* Select Power Management Mode */
        pxa27x_ohci_select_pmm(ohci, inf->port_mode);
 
-       ohci_finish_controller_resume(hcd);
+       ohci_resume(hcd, false);
        return 0;
 }
 
index 0d2309ca471eeb9fff1be06da36081f4878bd42c..281d5c658e364fcd609e612d25a1c27bc76c26da 100644 (file)
@@ -524,8 +524,7 @@ static int ohci_hcd_s3c2410_drv_resume(struct device *dev)
 
        s3c2410_start_hc(pdev, hcd);
 
-       set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
-       ohci_finish_controller_resume(hcd);
+       ohci_resume(hcd, false);
 
        return 0;
 }
index fc7305ee3c9cd465ecdb68c64b140e9f9da10fc9..d607be33c03c865a6a6abcd5245deee02e8b3a03 100644 (file)
@@ -231,7 +231,7 @@ static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
        ohci->next_statechange = jiffies;
 
        spear_start_ohci(ohci_p);
-       ohci_finish_controller_resume(hcd);
+       ohci_resume(hcd, false);
        return 0;
 }
 #endif
index 60c2b0722f2e16280f32db0ada071260e9ef30d4..2c9ab8f126d456df6ce02e7cccd771e651b4b3e6 100644 (file)
@@ -352,7 +352,7 @@ static int ohci_hcd_tmio_drv_resume(struct platform_device *dev)
 
        spin_unlock_irqrestore(&tmio->lock, flags);
 
-       ohci_finish_controller_resume(hcd);
+       ohci_resume(hcd, false);
 
        return 0;
 }