PM / OPP: Add opp_rcu_lockdep_assert() to _find_device_opp()
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 5 Nov 2015 08:51:21 +0000 (14:21 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 6 Nov 2015 22:59:42 +0000 (23:59 +0100)
_find_device_opp() should be called with rcu-read lock or
dev_opp_list_lock held. Add the opp_rcu_lockdep_assert() check to make
sure caller have taken appropriate locks.

Fix comment over the routine as well.

Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/opp/core.c

index d5f2156798203a3370129b6b83384e4d09b539ba..c987d2e1a83b3ee4ae06db7524d57da3c333f43c 100644 (file)
@@ -81,14 +81,18 @@ static struct device_opp *_managed_opp(const struct device_node *np)
  * Return: pointer to 'struct device_opp' if found, otherwise -ENODEV or
  * -EINVAL based on type of error.
  *
- * Locking: This function must be called under rcu_read_lock(). device_opp
- * is a RCU protected pointer. This means that device_opp is valid as long
- * as we are under RCU lock.
+ * Locking: For readers, this function must be called under rcu_read_lock().
+ * device_opp is a RCU protected pointer, which means that device_opp is valid
+ * as long as we are under RCU lock.
+ *
+ * For Writers, this function must be called with dev_opp_list_lock held.
  */
 struct device_opp *_find_device_opp(struct device *dev)
 {
        struct device_opp *dev_opp;
 
+       opp_rcu_lockdep_assert();
+
        if (IS_ERR_OR_NULL(dev)) {
                pr_err("%s: Invalid parameters\n", __func__);
                return ERR_PTR(-EINVAL);
This page took 0.026883 seconds and 5 git commands to generate.