cpufreq: davinci: Reuse cpufreq_generic_frequency_table_verify()
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 3 Jun 2016 05:28:52 +0000 (10:58 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 8 Jun 2016 22:58:07 +0000 (00:58 +0200)
policy->freq_table will always be valid for this platform, otherwise
driver's probe() would fail. And so this routine will *always* return
after calling cpufreq_frequency_table_verify().

This can be done using the generic callback provided by core, lets use
it instead.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/davinci-cpufreq.c

index 7e336d20c184b4a175ab196b2583ddd50069d475..b95a872800ecf0de6377cfb1b9e7481d2b673465 100644 (file)
@@ -38,26 +38,6 @@ struct davinci_cpufreq {
 };
 static struct davinci_cpufreq cpufreq;
 
-static int davinci_verify_speed(struct cpufreq_policy *policy)
-{
-       struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data;
-       struct cpufreq_frequency_table *freq_table = pdata->freq_table;
-       struct clk *armclk = cpufreq.armclk;
-
-       if (freq_table)
-               return cpufreq_frequency_table_verify(policy, freq_table);
-
-       if (policy->cpu)
-               return -EINVAL;
-
-       cpufreq_verify_within_cpu_limits(policy);
-       policy->min = clk_round_rate(armclk, policy->min * 1000) / 1000;
-       policy->max = clk_round_rate(armclk, policy->max * 1000) / 1000;
-       cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
-                                               policy->cpuinfo.max_freq);
-       return 0;
-}
-
 static int davinci_target(struct cpufreq_policy *policy, unsigned int idx)
 {
        struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data;
@@ -121,7 +101,7 @@ static int davinci_cpu_init(struct cpufreq_policy *policy)
 
 static struct cpufreq_driver davinci_driver = {
        .flags          = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK,
-       .verify         = davinci_verify_speed,
+       .verify         = cpufreq_generic_frequency_table_verify,
        .target_index   = davinci_target,
        .get            = cpufreq_generic_get,
        .init           = davinci_cpu_init,