Skip to content

Commit

Permalink
ARM: davinci: da850: Use cpufreq_for_each_entry macro for iteration
Browse files Browse the repository at this point in the history
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-and-tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
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 041526f commit 499f8ad
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions arch/arm/mach-davinci/da850.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,20 +1092,21 @@ int da850_register_cpufreq(char *async_clk)

static int da850_round_armrate(struct clk *clk, unsigned long rate)
{
int i, ret = 0, diff;
int ret = 0, diff;
unsigned int best = (unsigned int) -1;
struct cpufreq_frequency_table *table = cpufreq_info.freq_table;
struct cpufreq_frequency_table *pos;

rate /= 1000; /* convert to kHz */

for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
diff = table[i].frequency - rate;
cpufreq_for_each_entry(pos, table) {
diff = pos->frequency - rate;
if (diff < 0)
diff = -diff;

if (diff < best) {
best = diff;
ret = table[i].frequency;
ret = pos->frequency;
}
}

Expand Down

0 comments on commit 499f8ad

Please sign in to comment.