]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/base/power/main.c
Driver core: create lock/unlock functions for struct device
[mv-sheeva.git] / drivers / base / power / main.c
index 0e26a6f6fd48193e5c5fd3cec6a20269a4a5ddc9..d477f4dc5e514b202aaaa1efe0a6b20b3eeb62e3 100644 (file)
@@ -35,8 +35,8 @@
  * because children are guaranteed to be discovered after parents, and
  * are inserted at the back of the list on discovery.
  *
- * Since device_pm_add() may be called with a device semaphore held,
- * we must never try to acquire a device semaphore while holding
+ * Since device_pm_add() may be called with a device lock held,
+ * we must never try to acquire a device lock while holding
  * dpm_list_mutex.
  */
 
@@ -508,7 +508,7 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
        TRACE_RESUME(0);
 
        dpm_wait(dev->parent, async);
-       down(&dev->sem);
+       device_lock(dev);
 
        dev->power.status = DPM_RESUMING;
 
@@ -543,7 +543,7 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
                }
        }
  End:
-       up(&dev->sem);
+       device_unlock(dev);
        complete_all(&dev->power.completion);
 
        TRACE_RESUME(error);
@@ -629,7 +629,7 @@ static void dpm_resume(pm_message_t state)
  */
 static void device_complete(struct device *dev, pm_message_t state)
 {
-       down(&dev->sem);
+       device_lock(dev);
 
        if (dev->class && dev->class->pm && dev->class->pm->complete) {
                pm_dev_dbg(dev, state, "completing class ");
@@ -646,7 +646,7 @@ static void device_complete(struct device *dev, pm_message_t state)
                dev->bus->pm->complete(dev);
        }
 
-       up(&dev->sem);
+       device_unlock(dev);
 }
 
 /**
@@ -809,7 +809,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
        int error = 0;
 
        dpm_wait_for_children(dev, async);
-       down(&dev->sem);
+       device_lock(dev);
 
        if (async_error)
                goto End;
@@ -849,7 +849,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
                dev->power.status = DPM_OFF;
 
  End:
-       up(&dev->sem);
+       device_unlock(dev);
        complete_all(&dev->power.completion);
 
        return error;
@@ -938,7 +938,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
 {
        int error = 0;
 
-       down(&dev->sem);
+       device_lock(dev);
 
        if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) {
                pm_dev_dbg(dev, state, "preparing ");
@@ -962,7 +962,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
                suspend_report_result(dev->class->pm->prepare, error);
        }
  End:
-       up(&dev->sem);
+       device_unlock(dev);
 
        return error;
 }