Commit 02bacb21 authored by Viresh Kumar's avatar Viresh Kumar Committed by Eduardo Valentin

thermal: cpu_cooling: OPPs are registered for all CPUs

The OPPs are registered for all CPUs of a cpufreq policy now and we
don't need to run the loop in build_dyn_power_table(). Just check for
the policy->cpu and we should be fine.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
Tested-by: default avatarLukasz Luba <lukasz.luba@arm.com>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
parent b12b6519
...@@ -83,7 +83,7 @@ struct power_table { ...@@ -83,7 +83,7 @@ struct power_table {
* @dyn_power_table: array of struct power_table for frequency to power * @dyn_power_table: array of struct power_table for frequency to power
* conversion, sorted in ascending order. * conversion, sorted in ascending order.
* @dyn_power_table_entries: number of entries in the @dyn_power_table array * @dyn_power_table_entries: number of entries in the @dyn_power_table array
* @cpu_dev: the first cpu_device from @allowed_cpus that has OPPs registered * @cpu_dev: the cpu_device of policy->cpu.
* @plat_get_static_power: callback to calculate the static power * @plat_get_static_power: callback to calculate the static power
* *
* This structure is required for keeping information of each registered * This structure is required for keeping information of each registered
...@@ -207,23 +207,19 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_cdev, ...@@ -207,23 +207,19 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_cdev,
struct power_table *power_table; struct power_table *power_table;
struct dev_pm_opp *opp; struct dev_pm_opp *opp;
struct device *dev = NULL; struct device *dev = NULL;
int num_opps = 0, cpu, i, ret = 0; int num_opps = 0, cpu = cpufreq_cdev->policy->cpu, i, ret = 0;
unsigned long freq; unsigned long freq;
for_each_cpu(cpu, &cpufreq_cdev->allowed_cpus) {
dev = get_cpu_device(cpu); dev = get_cpu_device(cpu);
if (!dev) { if (unlikely(!dev)) {
dev_warn(&cpufreq_cdev->cdev->device, dev_warn(&cpufreq_cdev->cdev->device,
"No cpu device for cpu %d\n", cpu); "No cpu device for cpu %d\n", cpu);
continue; return -ENODEV;
} }
num_opps = dev_pm_opp_get_opp_count(dev); num_opps = dev_pm_opp_get_opp_count(dev);
if (num_opps > 0) if (num_opps < 0)
break;
else if (num_opps < 0)
return num_opps; return num_opps;
}
if (num_opps == 0) if (num_opps == 0)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment