From: Hitesh K. Patel <[email protected]>

add a quick path for hw_begin which don't
need to lock mutex when no need to resume

Signed-off-by: Yun Tu(Mark Tu) <[email protected]>
Signed-off-by: Hitesh K. Patel <[email protected]>
---
 drivers/staging/mrst/drv/psb_powermgmt.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/mrst/drv/psb_powermgmt.c 
b/drivers/staging/mrst/drv/psb_powermgmt.c
index 59509b6..7cdccae 100644
--- a/drivers/staging/mrst/drv/psb_powermgmt.c
+++ b/drivers/staging/mrst/drv/psb_powermgmt.c
@@ -1883,13 +1883,22 @@ bool ospm_power_using_hw_begin(int hw_island, bool 
force_on)
        bool ret = true;
        bool island_is_off = false;
        bool b_atomic = (in_interrupt() || in_atomic());
+       bool locked = true;
        struct pci_dev *pdev = gpDrmDevice->pdev;
        IMG_UINT32 deviceID = 0;
+       /*quick path, not 100% race safe, but should be enough comapre to 
current other code in this file */
+       if (!force_on) {
+               if (hw_island & (OSPM_ALL_ISLANDS & ~g_hw_power_status_mask))
+                       return false;
+               else {
+                       locked = false;
+                       goto increase_count;
+               }
+       }
+
 
-#if 0
        if (!b_atomic)
                mutex_lock(&g_ospm_mutex);
-#endif
 
        island_is_off = hw_island & (OSPM_ALL_ISLANDS & 
~g_hw_power_status_mask);
 
@@ -1983,7 +1992,7 @@ bool ospm_power_using_hw_begin(int hw_island, bool 
force_on)
 
                        gbResumeInProgress = false;
        }
-
+increase_count:
        if (ret) {
                switch(hw_island)
                {
@@ -2004,10 +2013,8 @@ bool ospm_power_using_hw_begin(int hw_island, bool 
force_on)
                pm_runtime_get(&pdev->dev);
        }
 
-#if 0
-       if (!b_atomic)
+       if (!b_atomic && locked)
                mutex_unlock(&g_ospm_mutex);
-#endif
 
        return ret;
 }
-- 
1.7.1

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to