diff mbox

[RFC,10/19] cpufreq: assert policy->rwsem is held in cpufreq_set_policy

Message ID 1452533760-13787-11-git-send-email-juri.lelli@arm.com
State New
Headers show

Commit Message

Juri Lelli Jan. 11, 2016, 5:35 p.m. UTC
Since cpufreq_set_policy is modifying policy, it has to work under policy->
rwsem protection.

Assert such condition.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Juri Lelli <juri.lelli@arm.com>

---
 drivers/cpufreq/cpufreq.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.2.2

Comments

Viresh Kumar Jan. 12, 2016, 10:15 a.m. UTC | #1
On 11-01-16, 17:35, Juri Lelli wrote:
> Since cpufreq_set_policy is modifying policy, it has to work under policy->

> rwsem protection.

> 

> Assert such condition.

> 

> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>

> Cc: Viresh Kumar <viresh.kumar@linaro.org>

> Signed-off-by: Juri Lelli <juri.lelli@arm.com>

> ---

>  drivers/cpufreq/cpufreq.c | 2 ++

>  1 file changed, 2 insertions(+)


Acked-by: Viresh Kumar <viresh.kumar@linaro.org>


-- 
viresh
diff mbox

Patch

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index d91fdb8..f1f9fbc 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2109,6 +2109,8 @@  static int cpufreq_set_policy(struct cpufreq_policy *policy,
 	pr_debug("setting new policy for CPU %u: %u - %u kHz\n",
 		 new_policy->cpu, new_policy->min, new_policy->max);
 
+	lockdep_assert_held(&policy->rwsem);
+
 	memcpy(&new_policy->cpuinfo, &policy->cpuinfo, sizeof(policy->cpuinfo));
 
 	/*