diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-11-05 03:51:21 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-11-06 17:59:42 -0500 |
commit | 0597e818501f595090a49a1779ab6ec377051b11 (patch) | |
tree | c533619d73d101302533e476b51dd8935385d820 /drivers/base/power/opp/core.c | |
parent | 4a3a1353a84796f93d389694e3b87ede533953fe (diff) |
PM / OPP: Add opp_rcu_lockdep_assert() to _find_device_opp()
_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>
Diffstat (limited to 'drivers/base/power/opp/core.c')
-rw-r--r-- | drivers/base/power/opp/core.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index d5f215679820..c987d2e1a83b 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c | |||
@@ -81,14 +81,18 @@ static struct device_opp *_managed_opp(const struct device_node *np) | |||
81 | * Return: pointer to 'struct device_opp' if found, otherwise -ENODEV or | 81 | * Return: pointer to 'struct device_opp' if found, otherwise -ENODEV or |
82 | * -EINVAL based on type of error. | 82 | * -EINVAL based on type of error. |
83 | * | 83 | * |
84 | * Locking: This function must be called under rcu_read_lock(). device_opp | 84 | * Locking: For readers, this function must be called under rcu_read_lock(). |
85 | * is a RCU protected pointer. This means that device_opp is valid as long | 85 | * device_opp is a RCU protected pointer, which means that device_opp is valid |
86 | * as we are under RCU lock. | 86 | * as long as we are under RCU lock. |
87 | * | ||
88 | * For Writers, this function must be called with dev_opp_list_lock held. | ||
87 | */ | 89 | */ |
88 | struct device_opp *_find_device_opp(struct device *dev) | 90 | struct device_opp *_find_device_opp(struct device *dev) |
89 | { | 91 | { |
90 | struct device_opp *dev_opp; | 92 | struct device_opp *dev_opp; |
91 | 93 | ||
94 | opp_rcu_lockdep_assert(); | ||
95 | |||
92 | if (IS_ERR_OR_NULL(dev)) { | 96 | if (IS_ERR_OR_NULL(dev)) { |
93 | pr_err("%s: Invalid parameters\n", __func__); | 97 | pr_err("%s: Invalid parameters\n", __func__); |
94 | return ERR_PTR(-EINVAL); | 98 | return ERR_PTR(-EINVAL); |