Nishanth Menon <[email protected]> writes:

> 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 <[email protected]>
> Cc: Kevin Hilman <[email protected]>
> Cc: Madhusudhan Chikkature Rajashekar <[email protected]>
> Cc: Paul Walmsley <[email protected]>
> Cc: Romit Dasgupta <[email protected]>
> Cc: Sanjeev Premi <[email protected]>
> Cc: Santosh Shilimkar <[email protected]>
> Cc: Sergio Alberto Aguirre Rodriguez <[email protected]>
> Cc: Thara Gopinath <[email protected]>
> Cc: Vishwanath Sripathy <[email protected]>
>
> Signed-off-by: Nishanth Menon <[email protected]>
> ---
>  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);

These two could just be replaced by a single call to
opp_find_freq_rounding()

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to