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