diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-07-30 03:10:35 -0400 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2015-08-14 21:26:23 -0400 |
commit | 1afb9c539daebc2c8a7b33d0e0b8fc9f74671b02 (patch) | |
tree | fc09b2a671c8890cacbd2358008d2a4bce44f2b6 | |
parent | abcbcc25cb3edfc3c9af210a88c9386e353191fe (diff) |
thermal/cpu_cooling: update policy limits if clipped_freq < policy->max
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>
-rw-r--r-- | drivers/thermal/cpu_cooling.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 71dbede9edaa..620dcd405ff6 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
@@ -229,9 +229,20 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, | |||
229 | if (!cpumask_test_cpu(policy->cpu, &cpufreq_dev->allowed_cpus)) | 229 | if (!cpumask_test_cpu(policy->cpu, &cpufreq_dev->allowed_cpus)) |
230 | continue; | 230 | continue; |
231 | 231 | ||
232 | /* | ||
233 | * policy->max is the maximum allowed frequency defined by user | ||
234 | * and clipped_freq is the maximum that thermal constraints | ||
235 | * allow. | ||
236 | * | ||
237 | * If clipped_freq is lower than policy->max, then we need to | ||
238 | * readjust policy->max. | ||
239 | * | ||
240 | * But, if clipped_freq is greater than policy->max, we don't | ||
241 | * need to do anything. | ||
242 | */ | ||
232 | clipped_freq = cpufreq_dev->clipped_freq; | 243 | clipped_freq = cpufreq_dev->clipped_freq; |
233 | 244 | ||
234 | if (policy->max != clipped_freq) | 245 | if (policy->max > clipped_freq) |
235 | cpufreq_verify_within_limits(policy, 0, clipped_freq); | 246 | cpufreq_verify_within_limits(policy, 0, clipped_freq); |
236 | break; | 247 | break; |
237 | } | 248 | } |