Skip to content

Commit

Permalink
irda: sh_sir: Use cpufreq_for_each_valid_entry macro for iteration
Browse files Browse the repository at this point in the history
The cpufreq core 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 3c84ef3 commit 04ae586
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions drivers/net/irda/sh_sir.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,17 @@ static int sh_sir_crc_init(struct sh_sir_self *self)
static u32 sh_sir_find_sclk(struct clk *irda_clk)
{
struct cpufreq_frequency_table *freq_table = irda_clk->freq_table;
struct cpufreq_frequency_table *pos;
struct clk *pclk = clk_get(NULL, "peripheral_clk");
u32 limit, min = 0xffffffff, tmp;
int i, index = 0;
int index = 0;

limit = clk_get_rate(pclk);
clk_put(pclk);

/* IrDA can not set over peripheral_clk */
for (i = 0;
freq_table[i].frequency != CPUFREQ_TABLE_END;
i++) {
u32 freq = freq_table[i].frequency;

if (freq == CPUFREQ_ENTRY_INVALID)
continue;
cpufreq_for_each_valid_entry(pos, freq_table) {
u32 freq = pos->frequency;

/* IrDA should not over peripheral_clk */
if (freq > limit)
Expand All @@ -240,7 +236,7 @@ static u32 sh_sir_find_sclk(struct clk *irda_clk)
tmp = freq % SCLK_BASE;
if (tmp < min) {
min = tmp;
index = i;
index = pos - freq_table;
}
}

Expand Down

0 comments on commit 04ae586

Please sign in to comment.