diff mbox

[12/17] cpufreq: use light-weight cpufreq_cpu_get_raw() in __cpufreq_add_dev

Message ID 0c3bdb11bedca250f4d60db7a1e1983e0f3d9072.1420181916.git.viresh.kumar@linaro.org
State New
Headers show

Commit Message

Viresh Kumar Jan. 2, 2015, 7:04 a.m. UTC
We just need to check if a 'policy' is already present for the cpu we are
adding. We don't need to take all the locks and do kobject usage updates. Use
the light-weight cpufreq_cpu_get_raw() routine instead.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 3061a5823e3c..788016cded33 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1109,11 +1109,9 @@  static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
 
 	/* check whether a different CPU already registered this
 	 * CPU because it is in the same boat. */
-	policy = cpufreq_cpu_get(cpu);
-	if (unlikely(policy)) {
-		cpufreq_cpu_put(policy);
+	policy = cpufreq_cpu_get_raw(cpu);
+	if (unlikely(policy))
 		return 0;
-	}
 
 	if (!down_read_trylock(&cpufreq_rwsem))
 		return 0;