Skip to content

Commit

Permalink
cpufreq: conservative: Rename get_freq_target() to get_freq_step()
Browse files Browse the repository at this point in the history
What's returned from this function is the delta by which the frequency
must be increased or decreased and not the final frequency that should
be selected.

Name it properly to match its purpose. Also update the variables used to
store that value.

Signed-off-by: Viresh Kumar <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
vireshk authored and rafaeljw committed Nov 14, 2016
1 parent c9a81e6 commit d5f905a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions drivers/cpufreq/cpufreq_conservative.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ struct cs_dbs_tuners {
#define DEF_SAMPLING_DOWN_FACTOR (1)
#define MAX_SAMPLING_DOWN_FACTOR (10)

static inline unsigned int get_freq_target(struct cs_dbs_tuners *cs_tuners,
struct cpufreq_policy *policy)
static inline unsigned int get_freq_step(struct cs_dbs_tuners *cs_tuners,
struct cpufreq_policy *policy)
{
unsigned int freq_target = (cs_tuners->freq_step * policy->max) / 100;
unsigned int freq_step = (cs_tuners->freq_step * policy->max) / 100;

/* max freq cannot be less than 100. But who knows... */
if (unlikely(freq_target == 0))
freq_target = DEF_FREQUENCY_STEP;
if (unlikely(freq_step == 0))
freq_step = DEF_FREQUENCY_STEP;

return freq_target;
return freq_step;
}

/*
Expand Down Expand Up @@ -90,7 +90,7 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *policy)
if (requested_freq == policy->max)
goto out;

requested_freq += get_freq_target(cs_tuners, policy);
requested_freq += get_freq_step(cs_tuners, policy);
if (requested_freq > policy->max)
requested_freq = policy->max;

Expand All @@ -106,16 +106,16 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *policy)

/* Check for frequency decrease */
if (load < cs_tuners->down_threshold) {
unsigned int freq_target;
unsigned int freq_step;
/*
* if we cannot reduce the frequency anymore, break out early
*/
if (requested_freq == policy->min)
goto out;

freq_target = get_freq_target(cs_tuners, policy);
if (requested_freq > freq_target)
requested_freq -= freq_target;
freq_step = get_freq_step(cs_tuners, policy);
if (requested_freq > freq_step)
requested_freq -= freq_step;
else
requested_freq = policy->min;

Expand Down

0 comments on commit d5f905a

Please sign in to comment.