Skip to content

Commit

Permalink
sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stratos Karafotis authored and Rafael J. Wysocki committed Apr 29, 2014
1 parent 04ae586 commit 4229e1c
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions drivers/sh/clk/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,11 @@ int clk_rate_table_find(struct clk *clk,
struct cpufreq_frequency_table *freq_table,
unsigned long rate)
{
int i;

for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
unsigned long freq = freq_table[i].frequency;
struct cpufreq_frequency_table *pos;

if (freq == CPUFREQ_ENTRY_INVALID)
continue;

if (freq == rate)
return i;
}
cpufreq_for_each_valid_entry(pos, freq_table)
if (pos->frequency == rate)
return pos - freq_table;

return -ENOENT;
}
Expand Down Expand Up @@ -575,11 +569,7 @@ long clk_round_parent(struct clk *clk, unsigned long target,
return abs(target - *best_freq);
}

for (freq = parent->freq_table; freq->frequency != CPUFREQ_TABLE_END;
freq++) {
if (freq->frequency == CPUFREQ_ENTRY_INVALID)
continue;

cpufreq_for_each_valid_entry(freq, parent->freq_table) {
if (unlikely(freq->frequency / target <= div_min - 1)) {
unsigned long freq_max;

Expand Down

0 comments on commit 4229e1c

Please sign in to comment.