diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-12-03 23:11:55 -0500 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2014-12-08 11:08:56 -0500 |
commit | 405fb8256226ad68cf6ba5172d289a70cb447c81 (patch) | |
tree | adcaf187ecf0ba4ae9395b5a3faf99594bafc56c /drivers/thermal/cpu_cooling.c | |
parent | 268ac445ee1b2b7c2806e7a21076e6d94aca1ca3 (diff) |
thermal: cpu_cooling: Don't match min/max frequencies for all CPUs on cooling register
In __cpufreq_cooling_register() we try to match min/max frequencies for all CPUs
passed in 'clip_cpus' mask. This mask is the cpumask of cpus where the frequency
constraints will be applied.
Same frequency constraint can be applied only to the CPUs belonging to the same
cluster (i.e. CPUs sharing clock line). For all such CPUs we have a single
'struct cpufreq_policy' structure managing them and so getting policies for all
CPUs wouldn't make any sense as they will all return the same pointer.
So, remove this useless check of checking min/max for all CPUs. Also update doc
comment to make this more obvious that clip_cpus should be same as
policy->related_cpus.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal/cpu_cooling.c')
-rw-r--r-- | drivers/thermal/cpu_cooling.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 5c9a2efeec22..f32573818db9 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
@@ -437,6 +437,7 @@ static struct notifier_block thermal_cpufreq_notifier_block = { | |||
437 | * __cpufreq_cooling_register - helper function to create cpufreq cooling device | 437 | * __cpufreq_cooling_register - helper function to create cpufreq cooling device |
438 | * @np: a valid struct device_node to the cooling device device tree node | 438 | * @np: a valid struct device_node to the cooling device device tree node |
439 | * @clip_cpus: cpumask of cpus where the frequency constraints will happen. | 439 | * @clip_cpus: cpumask of cpus where the frequency constraints will happen. |
440 | * Normally this should be same as cpufreq policy->related_cpus. | ||
440 | * | 441 | * |
441 | * This interface function registers the cpufreq cooling device with the name | 442 | * This interface function registers the cpufreq cooling device with the name |
442 | * "thermal-cpufreq-%x". This api can support multiple instances of cpufreq | 443 | * "thermal-cpufreq-%x". This api can support multiple instances of cpufreq |
@@ -452,30 +453,14 @@ __cpufreq_cooling_register(struct device_node *np, | |||
452 | { | 453 | { |
453 | struct thermal_cooling_device *cool_dev; | 454 | struct thermal_cooling_device *cool_dev; |
454 | struct cpufreq_cooling_device *cpufreq_dev; | 455 | struct cpufreq_cooling_device *cpufreq_dev; |
455 | unsigned int min = 0, max = 0; | ||
456 | char dev_name[THERMAL_NAME_LENGTH]; | 456 | char dev_name[THERMAL_NAME_LENGTH]; |
457 | int ret, i; | 457 | int ret; |
458 | struct cpufreq_policy policy; | ||
459 | 458 | ||
460 | if (!cpufreq_frequency_get_table(cpumask_first(clip_cpus))) { | 459 | if (!cpufreq_frequency_get_table(cpumask_first(clip_cpus))) { |
461 | pr_debug("%s: CPUFreq table not found\n", __func__); | 460 | pr_debug("%s: CPUFreq table not found\n", __func__); |
462 | return ERR_PTR(-EPROBE_DEFER); | 461 | return ERR_PTR(-EPROBE_DEFER); |
463 | } | 462 | } |
464 | 463 | ||
465 | /* Verify that all the clip cpus have same freq_min, freq_max limit */ | ||
466 | for_each_cpu(i, clip_cpus) { | ||
467 | /* continue if cpufreq policy not found and not return error */ | ||
468 | if (!cpufreq_get_policy(&policy, i)) | ||
469 | continue; | ||
470 | if (min == 0 && max == 0) { | ||
471 | min = policy.cpuinfo.min_freq; | ||
472 | max = policy.cpuinfo.max_freq; | ||
473 | } else { | ||
474 | if (min != policy.cpuinfo.min_freq || | ||
475 | max != policy.cpuinfo.max_freq) | ||
476 | return ERR_PTR(-EINVAL); | ||
477 | } | ||
478 | } | ||
479 | cpufreq_dev = kzalloc(sizeof(*cpufreq_dev), GFP_KERNEL); | 464 | cpufreq_dev = kzalloc(sizeof(*cpufreq_dev), GFP_KERNEL); |
480 | if (!cpufreq_dev) | 465 | if (!cpufreq_dev) |
481 | return ERR_PTR(-ENOMEM); | 466 | return ERR_PTR(-ENOMEM); |