Commit 04ae5864 authored by Stratos Karafotis's avatar Stratos Karafotis Committed by Rafael J. Wysocki

irda: sh_sir: Use cpufreq_for_each_valid_entry macro for iteration

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: default avatarStratos Karafotis <stratosk@semaphore.gr>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 3c84ef3a
...@@ -217,21 +217,17 @@ static int sh_sir_crc_init(struct sh_sir_self *self) ...@@ -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) static u32 sh_sir_find_sclk(struct clk *irda_clk)
{ {
struct cpufreq_frequency_table *freq_table = irda_clk->freq_table; struct cpufreq_frequency_table *freq_table = irda_clk->freq_table;
struct cpufreq_frequency_table *pos;
struct clk *pclk = clk_get(NULL, "peripheral_clk"); struct clk *pclk = clk_get(NULL, "peripheral_clk");
u32 limit, min = 0xffffffff, tmp; u32 limit, min = 0xffffffff, tmp;
int i, index = 0; int index = 0;
limit = clk_get_rate(pclk); limit = clk_get_rate(pclk);
clk_put(pclk); clk_put(pclk);
/* IrDA can not set over peripheral_clk */ /* IrDA can not set over peripheral_clk */
for (i = 0; cpufreq_for_each_valid_entry(pos, freq_table) {
freq_table[i].frequency != CPUFREQ_TABLE_END; u32 freq = pos->frequency;
i++) {
u32 freq = freq_table[i].frequency;
if (freq == CPUFREQ_ENTRY_INVALID)
continue;
/* IrDA should not over peripheral_clk */ /* IrDA should not over peripheral_clk */
if (freq > limit) if (freq > limit)
...@@ -240,7 +236,7 @@ static u32 sh_sir_find_sclk(struct clk *irda_clk) ...@@ -240,7 +236,7 @@ static u32 sh_sir_find_sclk(struct clk *irda_clk)
tmp = freq % SCLK_BASE; tmp = freq % SCLK_BASE;
if (tmp < min) { if (tmp < min) {
min = tmp; min = tmp;
index = i; index = pos - freq_table;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment