cpufreq: create cpufreq_table_count_valid_entries()

We need such a routine at two places already, lets create one.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Tested-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
This commit is contained in:
Viresh Kumar 2017-04-25 15:57:15 +05:30 committed by Eduardo Valentin
parent 4d753aa7b6
commit 55d8529313
3 changed files with 27 additions and 22 deletions

View file

@ -862,6 +862,20 @@ static inline int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
return -EINVAL;
}
}
static inline int cpufreq_table_count_valid_entries(const struct cpufreq_policy *policy)
{
struct cpufreq_frequency_table *pos;
int count = 0;
if (unlikely(!policy->freq_table))
return 0;
cpufreq_for_each_valid_entry(pos, policy->freq_table)
count++;
return count;
}
#else
static inline int cpufreq_boost_trigger_state(int state)
{