cpufreq: use light-weight cpufreq_cpu_get_raw() in __cpufreq_add_dev()
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 2 Jan 2015 07:04:33 +0000 (12:34 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 23 Jan 2015 21:49:34 +0000 (22:49 +0100)
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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c

index 127cc6f18ca515a9c55b5c67c1693bdb473d58a8..3a415130f6e111cc33bcf0f2f2cd9532d8e6febc 100644 (file)
@@ -1116,11 +1116,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;