mips: lemote 2f: Use cpufreq_for_each_entry macro for iteration
The cpufreq core now supports the cpufreq_for_each_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>
This commit is contained in:
parent
fdb56c45a2
commit
4966ee4037
@ -91,9 +91,9 @@ EXPORT_SYMBOL(clk_put);
|
|||||||
|
|
||||||
int clk_set_rate(struct clk *clk, unsigned long rate)
|
int clk_set_rate(struct clk *clk, unsigned long rate)
|
||||||
{
|
{
|
||||||
|
struct cpufreq_frequency_table *pos;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int regval;
|
int regval;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (likely(clk->ops && clk->ops->set_rate)) {
|
if (likely(clk->ops && clk->ops->set_rate)) {
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
@ -106,22 +106,16 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
|
|||||||
if (unlikely(clk->flags & CLK_RATE_PROPAGATES))
|
if (unlikely(clk->flags & CLK_RATE_PROPAGATES))
|
||||||
propagate_rate(clk);
|
propagate_rate(clk);
|
||||||
|
|
||||||
for (i = 0; loongson2_clockmod_table[i].frequency != CPUFREQ_TABLE_END;
|
cpufreq_for_each_valid_entry(pos, loongson2_clockmod_table)
|
||||||
i++) {
|
if (rate == pos->frequency)
|
||||||
if (loongson2_clockmod_table[i].frequency ==
|
|
||||||
CPUFREQ_ENTRY_INVALID)
|
|
||||||
continue;
|
|
||||||
if (rate == loongson2_clockmod_table[i].frequency)
|
|
||||||
break;
|
break;
|
||||||
}
|
if (rate != pos->frequency)
|
||||||
if (rate != loongson2_clockmod_table[i].frequency)
|
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
|
|
||||||
clk->rate = rate;
|
clk->rate = rate;
|
||||||
|
|
||||||
regval = LOONGSON_CHIPCFG0;
|
regval = LOONGSON_CHIPCFG0;
|
||||||
regval = (regval & ~0x7) |
|
regval = (regval & ~0x7) | (pos->driver_data - 1);
|
||||||
(loongson2_clockmod_table[i].driver_data - 1);
|
|
||||||
LOONGSON_CHIPCFG0 = regval;
|
LOONGSON_CHIPCFG0 = regval;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user