Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1306558 > unrolled thread

[RFC PATCH 17/19] cpufreq: stop checking for cpufreq_driver being present in cpufreq_cpu_get

Started byJuri Lelli <juri.lelli@arm.com>
First post2016-01-11 18:40 +0100
Last post2016-01-11 18:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC PATCH 17/19] cpufreq: stop checking for cpufreq_driver being present in cpufreq_cpu_get Juri Lelli <juri.lelli@arm.com> - 2016-01-11 18:40 +0100

#1306558 — [RFC PATCH 17/19] cpufreq: stop checking for cpufreq_driver being present in cpufreq_cpu_get

FromJuri Lelli <juri.lelli@arm.com>
Date2016-01-11 18:40 +0100
Subject[RFC PATCH 17/19] cpufreq: stop checking for cpufreq_driver being present in cpufreq_cpu_get
Message-ID<qPOBK-5zs-55@gated-at.bofh.it>
After cpufreq_driver_lock() is acquired in cpufreq_cpu_get() we are sure
we can't race with cpufreq_policy_free() (which is in the path that ends
up removing cpufreq_driver). We can thus safely remove check for
cpufreq_driver being present (which is a leftover from commit
6eed9404ab3c ("cpufreq: Use rwsem for protecting critical sections")).

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 | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 797bfae..6c9bef7 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -282,15 +282,15 @@ struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
 	if (WARN_ON(cpu >= nr_cpu_ids))
 		return NULL;
 
-	/* get the cpufreq driver */
 	read_lock_irqsave(&cpufreq_driver_lock, flags);
 
-	if (cpufreq_driver) {
-		/* get the CPU */
-		policy = cpufreq_cpu_get_raw(cpu);
-		if (policy)
-			kobject_get(&policy->kobj);
-	}
+	/*
+	 * If we get a policy, cpufreq_policy_free() didn't
+	 * yet run.
+	 */
+	policy = cpufreq_cpu_get_raw(cpu);
+	if (policy)
+		kobject_get(&policy->kobj);
 
 	read_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
-- 
2.2.2

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web