cpufreq: pxa: call cpufreq_frequency_table_get_attr()
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 16 Sep 2013 13:26:04 +0000 (18:56 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 30 Sep 2013 18:18:41 +0000 (20:18 +0200)
This exposes frequency table of driver to cpufreq core and is required for core
to guess what the index for a target frequency is, when it calls
cpufreq_frequency_table_target(). And so this driver needs to expose it.

Cc: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/pxa2xx-cpufreq.c
drivers/cpufreq/pxa3xx-cpufreq.c

index 8749eaf1879338ad331f587c9a716a501ab0c701..b004cf1d07afe1e356323f2ee892ceae9db3422d 100644 (file)
@@ -453,20 +453,31 @@ static int pxa_cpufreq_init(struct cpufreq_policy *policy)
                find_freq_tables(&pxa255_freq_table, &pxa255_freqs);
                pr_info("PXA255 cpufreq using %s frequency table\n",
                        pxa255_turbo_table ? "turbo" : "run");
+
                cpufreq_frequency_table_cpuinfo(policy, pxa255_freq_table);
+               cpufreq_frequency_table_get_attr(pxa255_freq_table, policy->cpu);
        }
-       else if (cpu_is_pxa27x())
+       else if (cpu_is_pxa27x()) {
                cpufreq_frequency_table_cpuinfo(policy, pxa27x_freq_table);
+               cpufreq_frequency_table_get_attr(pxa27x_freq_table, policy->cpu);
+       }
 
        printk(KERN_INFO "PXA CPU frequency change support initialized\n");
 
        return 0;
 }
 
+static int pxa_cpufreq_exit(struct cpufreq_policy *policy)
+{
+       cpufreq_frequency_table_put_attr(policy->cpu);
+       return 0;
+}
+
 static struct cpufreq_driver pxa_cpufreq_driver = {
        .verify = pxa_verify_policy,
        .target = pxa_set_target,
        .init   = pxa_cpufreq_init,
+       .exit   = pxa_cpufreq_exit,
        .get    = pxa_cpufreq_get,
        .name   = "PXA2xx",
 };
index d26306fb00d2e8a749ed044c816533f101defd11..cebbed19765e4fadb04d38666da5613eb78a4fba 100644 (file)
@@ -91,7 +91,7 @@ static int setup_freqs_table(struct cpufreq_policy *policy,
                             struct pxa3xx_freq_info *freqs, int num)
 {
        struct cpufreq_frequency_table *table;
-       int i;
+       int i, ret;
 
        table = kzalloc((num + 1) * sizeof(*table), GFP_KERNEL);
        if (table == NULL)
@@ -108,7 +108,11 @@ static int setup_freqs_table(struct cpufreq_policy *policy,
        pxa3xx_freqs_num = num;
        pxa3xx_freqs_table = table;
 
-       return cpufreq_frequency_table_cpuinfo(policy, table);
+       ret = cpufreq_frequency_table_cpuinfo(policy, table);
+       if (!ret)
+               cpufreq_frequency_table_get_attr(table, policy->cpu);
+
+       return ret;
 }
 
 static void __update_core_freq(struct pxa3xx_freq_info *info)
@@ -229,10 +233,17 @@ static int pxa3xx_cpufreq_init(struct cpufreq_policy *policy)
        return 0;
 }
 
+static int pxa3xx_cpufreq_exit(struct cpufreq_policy *policy)
+{
+       cpufreq_frequency_table_put_attr(policy->cpu);
+       return 0;
+}
+
 static struct cpufreq_driver pxa3xx_cpufreq_driver = {
        .verify         = pxa3xx_cpufreq_verify,
        .target         = pxa3xx_cpufreq_set,
        .init           = pxa3xx_cpufreq_init,
+       .exit           = pxa3xx_cpufreq_exit,
        .get            = pxa3xx_cpufreq_get,
        .name           = "pxa3xx-cpufreq",
 };