diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-12-03 23:11:59 -0500 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2014-12-08 11:09:52 -0500 |
commit | 7adb635b3cd790e4e0d7e9d0b3dd30574ae36596 (patch) | |
tree | b8671125e393090c978db30039f259b0f7282c1a | |
parent | 730abe064b6f8860302b75a689ceed059c08e0b1 (diff) |
thermal: cpu_cooling: initialize 'cpufreq_val' on registration
There is no point checking for validity of 'cpufreq_val' from
cpufreq_thermal_notifier() every time the routine is called. Its guaranteed to
be 0 on the first call but will be valid otherwise.
Lets update it once while the device registers.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
-rw-r--r-- | drivers/thermal/cpu_cooling.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 491d90aeeebe..86bcf8dc14d3 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
@@ -316,11 +316,6 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, | |||
316 | &cpufreq_dev->allowed_cpus)) | 316 | &cpufreq_dev->allowed_cpus)) |
317 | continue; | 317 | continue; |
318 | 318 | ||
319 | if (!cpufreq_dev->cpufreq_val) | ||
320 | cpufreq_dev->cpufreq_val = get_cpu_frequency( | ||
321 | cpumask_any(&cpufreq_dev->allowed_cpus), | ||
322 | cpufreq_dev->cpufreq_state); | ||
323 | |||
324 | max_freq = cpufreq_dev->cpufreq_val; | 319 | max_freq = cpufreq_dev->cpufreq_val; |
325 | 320 | ||
326 | if (policy->max != max_freq) | 321 | if (policy->max != max_freq) |
@@ -444,6 +439,13 @@ __cpufreq_cooling_register(struct device_node *np, | |||
444 | if (!cpufreq_dev) | 439 | if (!cpufreq_dev) |
445 | return ERR_PTR(-ENOMEM); | 440 | return ERR_PTR(-ENOMEM); |
446 | 441 | ||
442 | cpufreq_dev->cpufreq_val = get_cpu_frequency(cpumask_any(clip_cpus), 0); | ||
443 | if (!cpufreq_dev->cpufreq_val) { | ||
444 | pr_err("%s: Failed to get frequency", __func__); | ||
445 | cool_dev = ERR_PTR(-EINVAL); | ||
446 | goto free_cdev; | ||
447 | } | ||
448 | |||
447 | cpumask_copy(&cpufreq_dev->allowed_cpus, clip_cpus); | 449 | cpumask_copy(&cpufreq_dev->allowed_cpus, clip_cpus); |
448 | 450 | ||
449 | ret = get_idr(&cpufreq_idr, &cpufreq_dev->id); | 451 | ret = get_idr(&cpufreq_idr, &cpufreq_dev->id); |