PM / QoS: Use lockdep asserts to find missing hold of power.lock
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>
Fri, 9 Jan 2015 08:27:58 +0000 (09:27 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 23 Jan 2015 21:31:08 +0000 (22:31 +0100)
Add lockdep asserts for holding the dev->power.lock to non-static
functions which require this. They could be used outside of the file so
asserts may help in detecting locking misuse.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/qos.c

index a8fe4c1a8d07a6e099317c8decd85c3275eff3a2..e56d538d039e4220276ea772d9cd6c2ccd95d1d2 100644 (file)
@@ -64,6 +64,8 @@ enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask)
        struct pm_qos_flags *pqf;
        s32 val;
 
+       lockdep_assert_held(&dev->power.lock);
+
        if (IS_ERR_OR_NULL(qos))
                return PM_QOS_FLAGS_UNDEFINED;
 
@@ -104,6 +106,8 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_flags);
  */
 s32 __dev_pm_qos_read_value(struct device *dev)
 {
+       lockdep_assert_held(&dev->power.lock);
+
        return IS_ERR_OR_NULL(dev->power.qos) ?
                0 : pm_qos_read_value(&dev->power.qos->resume_latency);
 }