}
}
- if (up_count * 100 >= num_pass_gov * up_threshold)
+ if (up_count * 100 >= num_pass_gov * up_threshold) {
level += policy->cpufreq.num_nr_cpus;
- else if (down_count * 100 >= num_pass_gov * down_threshold)
+
+ if (level > policy->max_level)
+ level -= policy->cpufreq.num_nr_cpus;
+ } else if (down_count * 100 >= num_pass_gov * down_threshold) {
level -= policy->cpufreq.num_nr_cpus;
+ }
- if (right_count * 100 >= num_pass_gov * up_threshold)
+ if (right_count * 100 >= num_pass_gov * up_threshold) {
level += 1;
- else if (left_count * 100 >= num_pass_gov * down_threshold)
+
+ if (level > policy->max_level)
+ level -= 1;
+ } else if (left_count * 100 >= num_pass_gov * down_threshold) {
level -= 1;
+ }
/*
if (level == policy->prev_level) {