Re: [PATCH 3/3] thermal: cpu_cooling: Migrate to using the EM framework

Viresh Kumar
2019-04-10T05:44:54Z

On 28-03-19, 10:13, Quentin Perret wrote:
> +static unsigned int get_state_freq(struct cpufreq_cooling_device *cpufreq_cdev,
> + unsigned long state)
> +{
> + struct cpufreq_policy *policy;
> + unsigned long idx;
> +
> + /* Use the Energy Model table if available */
> + if (cpufreq_cdev->em) {
> + idx = cpufreq_cdev->max_level - state;
> + return cpufreq_cdev->em->table[idx].frequency;
> + }
> +
> + /* Otherwise, fallback on the CPUFreq table */
> + policy = cpufreq_cdev->policy;
> + if (policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_ASCENDING)

It is not guaranteed that the frequency table is sorted in any order, isn't it ?

> + idx = cpufreq_cdev->max_level - state;
> + else
> + idx = state;

--
viresh