summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNishanth Menon <nm@ti.com>2013-01-18 20:52:34 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-22 13:28:39 +0100
commitbcb27549f4185ca7d0168e201931613706ef2b83 (patch)
treec9c77e26c0c9b8ef5aa4c85efff2464900283b69 /drivers
parentcpufreq: cpufreq-cpu0: use RCU locks around usage of OPP (diff)
downloadlinux-bcb27549f4185ca7d0168e201931613706ef2b83.tar.xz
linux-bcb27549f4185ca7d0168e201931613706ef2b83.zip
PM / devfreq: add locking documentation for recommended_opp
OPP pointers are protected by RCU locks, the pointer validity is permissible only under the section of rcu_read_lock to rcu_read_unlock Add documentation to the effect. Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/devfreq/devfreq.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 53766f39aadd..3b367973a802 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -994,6 +994,11 @@ module_exit(devfreq_exit);
* @freq: The frequency given to target function
* @flags: Flags handed from devfreq framework.
*
+ * Locking: This function must be called under rcu_read_lock(). opp is a rcu
+ * protected pointer. The reason for the same is that the opp pointer which is
+ * returned will remain valid for use with opp_get_{voltage, freq} only while
+ * under the locked area. The pointer returned must be used prior to unlocking
+ * with rcu_read_unlock() to maintain the integrity of the pointer.
*/
struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq,
u32 flags)