1
0
Fork 0

sh: clk: Use cpufreq_for_each_valid_entry macro for iteration

The cpufreq core now supports the cpufreq_for_each_valid_entry macro
helper for iteration over the cpufreq_frequency_table, so use it.

It should have no functional changes.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
hifive-unleashed-5.1
Stratos Karafotis 2014-04-25 23:16:58 +03:00 committed by Rafael J. Wysocki
parent 04ae58645a
commit 4229e1c61a
1 changed files with 5 additions and 15 deletions

View File

@ -196,17 +196,11 @@ int clk_rate_table_find(struct clk *clk,
struct cpufreq_frequency_table *freq_table, struct cpufreq_frequency_table *freq_table,
unsigned long rate) unsigned long rate)
{ {
int i; struct cpufreq_frequency_table *pos;
for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { cpufreq_for_each_valid_entry(pos, freq_table)
unsigned long freq = freq_table[i].frequency; if (pos->frequency == rate)
return pos - freq_table;
if (freq == CPUFREQ_ENTRY_INVALID)
continue;
if (freq == rate)
return i;
}
return -ENOENT; return -ENOENT;
} }
@ -575,11 +569,7 @@ long clk_round_parent(struct clk *clk, unsigned long target,
return abs(target - *best_freq); return abs(target - *best_freq);
} }
for (freq = parent->freq_table; freq->frequency != CPUFREQ_TABLE_END; cpufreq_for_each_valid_entry(freq, parent->freq_table) {
freq++) {
if (freq->frequency == CPUFREQ_ENTRY_INVALID)
continue;
if (unlikely(freq->frequency / target <= div_min - 1)) { if (unlikely(freq->frequency / target <= div_min - 1)) {
unsigned long freq_max; unsigned long freq_max;