Skip to content
This repository has been archived by the owner on Jan 7, 2018. It is now read-only.

Commit

Permalink
alucard CPU governor: code optimization for function choose_target_freq.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alucard24 authored and AndroPlus-org committed Dec 2, 2016
1 parent 62e24a6 commit 89b94c8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions drivers/cpufreq/cpufreq_alucard.c
Expand Up @@ -212,8 +212,8 @@ static unsigned int choose_target_freq(struct cpufreq_alucard_policyinfo *pcpu,
struct cpufreq_policy *policy = pcpu->policy;
struct cpufreq_frequency_table *table = pcpu->freq_table;
struct cpufreq_frequency_table *pos;
unsigned int i = 0, target_freq = 0, freq;
int count = 0;
unsigned int target_freq = 0, freq;
int i = 0, t = 0;

if (!policy || !table || !step)
return 0;
Expand All @@ -224,19 +224,21 @@ static unsigned int choose_target_freq(struct cpufreq_alucard_policyinfo *pcpu,
if (isup) {
if (freq > policy->cur) {
target_freq = freq;
count++;
if (count == step)
step--;
if (step == 0) {
break;
}
}
} else {
if (freq == policy->cur) {
for (count = (i - 1); count >= 0; count--) {
if (table[count].frequency != CPUFREQ_ENTRY_INVALID) {
target_freq = table[count].frequency;
for (t = (i - 1); t >= 0; t--) {
if (table[t].frequency != CPUFREQ_ENTRY_INVALID) {
target_freq = table[t].frequency;
step--;
if (step == 0) {
break;
}
}
if (step == 0)
break;
}
break;
}
Expand Down

0 comments on commit 89b94c8

Please sign in to comment.