]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
usb: host: tegra: reduce delay in driver remove
authorRohith Seelaboyina <rseelaboyina@nvidia.com>
Thu, 25 Jul 2013 11:52:56 +0000 (17:22 +0530)
committerDan Willemsen <dwillemsen@nvidia.com>
Sat, 14 Sep 2013 20:38:42 +0000 (13:38 -0700)
Following are taken care:
1. Add check conditions before updating the pm_qos nodes
2. Reduce delay in driver remove path to sync
ehci_bus_resume, ehci_bus_suspend, ehci_remove

Bug 1316354
Bug 1331078

Change-Id: I51e251474a9def65286e7a6f8099ad9cdc40d0ea
Signed-off-by: Rohith Seelaboyina <rseelaboyina@nvidia.com>
Reviewed-on: http://git-master/r/253405
(cherry picked from commit ce7b1404c080c71580aa0d6b0f944c398c36d7b4)
Reviewed-on: http://git-master/r/256295
Reviewed-by: Mandar Padmawar <mpadmawar@nvidia.com>
Tested-by: Mandar Padmawar <mpadmawar@nvidia.com>
drivers/usb/host/ehci-tegra.c

index a3ff87d6c3c8afa6ee1fc27d349e813a0bb73798..3c02a0c7166e80dbdb9817146e90844cf8be5618 100644 (file)
@@ -379,7 +379,8 @@ static int tegra_ehci_bus_suspend(struct usb_hcd *hcd)
        EHCI_DBG("%s() BEGIN\n", __func__);
 
 #ifdef CONFIG_TEGRA_EHCI_BOOST_CPU_FREQ
-       pm_qos_update_request(&tegra->boost_cpu_freq_req,
+       if (pm_qos_request_active(&tegra->boost_cpu_freq_req))
+               pm_qos_update_request(&tegra->boost_cpu_freq_req,
                        PM_QOS_DEFAULT_VALUE);
        tegra->cpu_boost_in_work = false;
 #endif
@@ -404,7 +405,8 @@ static int tegra_ehci_bus_resume(struct usb_hcd *hcd)
        EHCI_DBG("%s() BEGIN\n", __func__);
 
 #ifdef CONFIG_TEGRA_EHCI_BOOST_CPU_FREQ
-       pm_qos_update_request(&tegra->boost_cpu_freq_req,
+       if (pm_qos_request_active(&tegra->boost_cpu_freq_req))
+               pm_qos_update_request(&tegra->boost_cpu_freq_req,
                        (s32)CONFIG_TEGRA_EHCI_BOOST_CPU_FREQ * 1000);
        tegra->cpu_boost_in_work = false;
 
@@ -662,16 +664,16 @@ static int tegra_ehci_remove(struct platform_device *pdev)
                tegra_usb_phy_power_on(tegra->phy);
 
        if (pdata->port_otg) {
-
                timeout = jiffies + 5 * HZ;
-
                /* wait for devices connected to root hub to disconnect*/
-               while (time_before(jiffies, timeout) &&
-                       rhdev && usb_hub_find_child(rhdev, 0))
-                       ;
-
-               /* wait for any control packets sent to root hub to complete */
-               msleep(1000);
+               while (rhdev && usb_hub_find_child(rhdev, 1)) {
+                       /* wait for any control packets
+                       sent to root hub to complete */
+                       if (time_after(jiffies, timeout))
+                               break;
+                       msleep(20);
+                       cpu_relax();
+               }
        }
 
        usb_remove_hcd(hcd);