summaryrefslogtreecommitdiff
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorDonghan Ryu <dryu@nvidia.com>2012-01-31 17:55:40 +0900
committerSimone Willett <swillett@nvidia.com>2012-02-09 12:56:16 -0800
commitf281fd2cb19e333a560f1454a6e1d9ccd6886ca3 (patch)
tree251181b95a324d4caff13b1f1b6dcaaa3aa30f40 /drivers/cpufreq
parent710e291cabb68d047b9098f24baa22556b1e3ec0 (diff)
cpufreq: properly clamp QoS min/max
typically PM QoS clients request the maximum cpu frequency by setting cpu_freq_min to INT_MAX. Therefore, we need to clamp INT_MAX to whatever the maximum frequency allowed by the policy to make the requested cpu_freq_min is same as the maximum allowed cpu frequency. Inverse logic applies to the cpu_freq_max as well. Bug 932477 Signed-off-by: Donghan Ryu <dryu@nvidia.com> Reviewed-on: http://git-master/r/78401 (cherry picked from commit 9688430a621515f3afe3e0ab358ea7ad5aab6d91) Change-Id: Ie5edcd4a873ed5cce45ec0f9b981f28db6091ff1 Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com> Reviewed-on: http://git-master/r/80002 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 698bf4aee6f8..a76470358e77 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1635,8 +1635,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
int ret = 0;
unsigned int pmin = policy->min;
unsigned int pmax = policy->max;
- unsigned int qmin = pm_qos_request(PM_QOS_CPU_FREQ_MIN);
- unsigned int qmax = pm_qos_request(PM_QOS_CPU_FREQ_MAX);
+ unsigned int qmin = min(pm_qos_request(PM_QOS_CPU_FREQ_MIN), data->max);
+ unsigned int qmax = max(pm_qos_request(PM_QOS_CPU_FREQ_MAX), data->min);
pr_debug("setting new policy for CPU %u: %u - %u (%u - %u) kHz\n",
policy->cpu, pmin, pmax, qmin, qmax);