[<prev] [next>] [day] [month] [year] [list]
Message-Id: <6f78bb732c54ff35c4adfc0de256f20fe7cd39ba.1446713282.git.viresh.kumar@linaro.org>
Date: Thu, 5 Nov 2015 14:21:21 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Rafael Wysocki <rjw@...ysocki.net>,
Stephen Boyd <sboyd@...eaurora.org>
Cc: linaro-kernel@...ts.linaro.org, linux-pm@...r.kernel.org,
Viresh Kumar <viresh.kumar@...aro.org>,
"4 . 3 # 4 . 3" <stable@...r.kernel.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Dmitry Torokhov <dtor@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Len Brown <len.brown@...el.com>,
linux-kernel@...r.kernel.org (open list),
Nishanth Menon <nm@...com>, Pavel Machek <pavel@....cz>
Subject: [PATCH V2 4/4] 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.
Cc: 4.3 <stable@...r.kernel.org> # 4.3
Suggested-by: Stephen Boyd <sboyd@...eaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
drivers/base/power/opp/core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index 7a395f5ba5f9..5e4b1d82b2f8 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)
* 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);
--
2.6.2.198.g614a2ac
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists