cpufreq: conservative: Ensure requested_freq within policy min/max range
Jinyoung Park [Mon, 2 Sep 2013 05:39:34 +0000 (14:39 +0900)]
Ensure requested_freq within policy min/max reage.

Bug 1354391

Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-on: http://git-master/r/268953
(cherry picked from commit 7f53b0accdf31b0e58b883e6bab1a4e71fa429be)

Change-Id: I55d0221a228c3cdeef3f9ced0a0ecb8bbdb21427
Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-on: http://git-master/r/301038
Reviewed-by: Harry Hong <hhong@nvidia.com>
Tested-by: Harry Hong <hhong@nvidia.com>

drivers/cpufreq/cpufreq_conservative.c

index 4c69fbf..7ae376e 100644 (file)
@@ -411,6 +411,10 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
                if (this_dbs_info->requested_freq > policy->max)
                        this_dbs_info->requested_freq = policy->max;
 
+               /* Ensure requested_freq within policy min/max range. */
+               this_dbs_info->requested_freq =
+                               max(policy->min, this_dbs_info->requested_freq);
+
                __cpufreq_driver_target(policy, this_dbs_info->requested_freq,
                        CPUFREQ_RELATION_H);
                return;
@@ -430,6 +434,10 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
                } else
                        this_dbs_info->requested_freq = policy->min;
 
+               /* Ensure requested_freq within policy min/max range. */
+               this_dbs_info->requested_freq =
+                               min(policy->max, this_dbs_info->requested_freq);
+
                /*
                 * if we cannot reduce the frequency anymore, break out early
                 */