Skip to content

Commit

Permalink
thermal/cpu_cooling: update policy limits if clipped_freq < policy->max
Browse files Browse the repository at this point in the history
policy->max is the maximum allowed frequency defined by user and
clipped_freq is the maximum that thermal constraints allow.

If clipped_freq is lower than policy->max, then we need to readjust
policy->max.

But, if clipped_freq is greater than policy->max, we don't need to do
anything. We used to call cpufreq_verify_within_limits() in this case,
but it doesn't change anything in this case.

Lets skip this unnecessary call and write a comment that explains this.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
  • Loading branch information
Viresh Kumar authored and Eduardo Valentin committed Aug 15, 2015
1 parent abcbcc2 commit 1afb9c5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/thermal/cpu_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,20 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,
if (!cpumask_test_cpu(policy->cpu, &cpufreq_dev->allowed_cpus))
continue;

/*
* policy->max is the maximum allowed frequency defined by user
* and clipped_freq is the maximum that thermal constraints
* allow.
*
* If clipped_freq is lower than policy->max, then we need to
* readjust policy->max.
*
* But, if clipped_freq is greater than policy->max, we don't
* need to do anything.
*/
clipped_freq = cpufreq_dev->clipped_freq;

if (policy->max != clipped_freq)
if (policy->max > clipped_freq)
cpufreq_verify_within_limits(policy, 0, clipped_freq);
break;
}
Expand Down

0 comments on commit 1afb9c5

Please sign in to comment.