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

mfd: db8500-prcmu: 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: 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 499f8ad5
...@@ -1734,18 +1734,17 @@ static struct cpufreq_frequency_table db8500_cpufreq_table[] = { ...@@ -1734,18 +1734,17 @@ static struct cpufreq_frequency_table db8500_cpufreq_table[] = {
static long round_armss_rate(unsigned long rate) static long round_armss_rate(unsigned long rate)
{ {
struct cpufreq_frequency_table *pos;
long freq = 0; long freq = 0;
int i = 0;
/* cpufreq table frequencies is in KHz. */ /* cpufreq table frequencies is in KHz. */
rate = rate / 1000; rate = rate / 1000;
/* Find the corresponding arm opp from the cpufreq table. */ /* Find the corresponding arm opp from the cpufreq table. */
while (db8500_cpufreq_table[i].frequency != CPUFREQ_TABLE_END) { cpufreq_for_each_entry(pos, db8500_cpufreq_table) {
freq = db8500_cpufreq_table[i].frequency; freq = pos->frequency;
if (freq == rate) if (freq == rate)
break; break;
i++;
} }
/* Return the last valid value, even if a match was not found. */ /* Return the last valid value, even if a match was not found. */
...@@ -1886,23 +1885,21 @@ static void set_clock_rate(u8 clock, unsigned long rate) ...@@ -1886,23 +1885,21 @@ static void set_clock_rate(u8 clock, unsigned long rate)
static int set_armss_rate(unsigned long rate) static int set_armss_rate(unsigned long rate)
{ {
int i = 0; struct cpufreq_frequency_table *pos;
/* cpufreq table frequencies is in KHz. */ /* cpufreq table frequencies is in KHz. */
rate = rate / 1000; rate = rate / 1000;
/* Find the corresponding arm opp from the cpufreq table. */ /* Find the corresponding arm opp from the cpufreq table. */
while (db8500_cpufreq_table[i].frequency != CPUFREQ_TABLE_END) { cpufreq_for_each_entry(pos, db8500_cpufreq_table)
if (db8500_cpufreq_table[i].frequency == rate) if (pos->frequency == rate)
break; break;
i++;
}
if (db8500_cpufreq_table[i].frequency != rate) if (pos->frequency != rate)
return -EINVAL; return -EINVAL;
/* Set the new arm opp. */ /* Set the new arm opp. */
return db8500_prcmu_set_arm_opp(db8500_cpufreq_table[i].driver_data); return db8500_prcmu_set_arm_opp(pos->driver_data);
} }
static int set_plldsi_rate(unsigned long rate) static int set_plldsi_rate(unsigned long rate)
......
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