The logic in omap-target can now be improved with the accessor functions. Dont scan through the list manually, instead use get_next_freq to do the scanning. Cc: Benoit Cousson <b-cousson@xxxxxx> Cc: Kevin Hilman <khilman@xxxxxxxxxxxxxxxxxxx> Cc: Madhusudhan Chikkature Rajashekar <madhu.cr@xxxxxx> Cc: Paul Walmsley <paul@xxxxxxxxx> Cc: Romit Dasgupta <romit@xxxxxx> Cc: Sanjeev Premi <premi@xxxxxx> Cc: Santosh Shilimkar <santosh.shilimkar@xxxxxx> Cc: Sergio Alberto Aguirre Rodriguez <saaguirre@xxxxxx> Cc: Thara Gopinath <thara@xxxxxx> Cc: Vishwanath Sripathy <vishwanath.bs@xxxxxx> Signed-off-by: Nishanth Menon <nm@xxxxxx> --- arch/arm/plat-omap/cpu-omap.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c index 449b6b6..7b3ca11 100644 --- a/arch/arm/plat-omap/cpu-omap.c +++ b/arch/arm/plat-omap/cpu-omap.c @@ -111,14 +111,17 @@ static int omap_target(struct cpufreq_policy *policy, cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); #elif defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE) if (mpu_opps) { - int ind; - for (ind = 1; ind <= MAX_VDD1_OPP; ind++) { - if (mpu_opps[ind].rate/1000 >= target_freq) { - omap_pm_cpu_set_freq - (mpu_opps[ind].rate); - break; - } - } + unsigned long freq = target_freq * 1000; + struct omap_opp *opp = NULL; + int res; + /* see if we have exact freq match */ + res = opp_is_valid(&opp, mpu_opps, freq); + /* Get next best if we cant find a exact match */ + if (res) + res = opp_get_higher_opp(&opp, &freq, mpu_opps); + + if (!res) + omap_pm_cpu_set_freq(freq); } #endif return ret; -- 1.6.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html