From 30aa53412797a45b0b21da332e7a0fc6a74bb061 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Mon, 16 Sep 2013 18:56:20 +0530 Subject: cpufreq: longhaul: use cpufreq_table_validate_and_show() Lets use cpufreq_table_validate_and_show() instead of calling cpufreq_frequency_table_cpuinfo() and cpufreq_frequency_table_get_attr(). Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/longhaul.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'drivers/cpufreq/longhaul.c') diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index 4ada1cccb052..70b66fda3cad 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c @@ -921,13 +921,7 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = 200000; /* nsec */ policy->cur = calc_speed(longhaul_get_cpu_mult()); - ret = cpufreq_frequency_table_cpuinfo(policy, longhaul_table); - if (ret) - return ret; - - cpufreq_frequency_table_get_attr(longhaul_table, policy->cpu); - - return 0; + return cpufreq_table_validate_and_show(policy, longhaul_table); } static int longhaul_cpu_exit(struct cpufreq_policy *policy) -- cgit v1.2.3 From 3a4d0342ebada05810a2400ef1db3c66d88ef22c Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Thu, 3 Oct 2013 20:28:10 +0530 Subject: cpufreq: longhaul: Use generic cpufreq routines Most of the CPUFreq drivers do similar things in .exit() and .verify() routines and .attr. So its better if we have generic routines for them which can be used by cpufreq drivers then. This patch uses these generic routines in the longhaul driver. Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/longhaul.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'drivers/cpufreq/longhaul.c') diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index 70b66fda3cad..57d7b02f863a 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c @@ -625,12 +625,6 @@ static void longhaul_setup_voltagescaling(void) } -static int longhaul_verify(struct cpufreq_policy *policy) -{ - return cpufreq_frequency_table_verify(policy, longhaul_table); -} - - static int longhaul_target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation) { @@ -924,25 +918,14 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy) return cpufreq_table_validate_and_show(policy, longhaul_table); } -static int longhaul_cpu_exit(struct cpufreq_policy *policy) -{ - cpufreq_frequency_table_put_attr(policy->cpu); - return 0; -} - -static struct freq_attr *longhaul_attr[] = { - &cpufreq_freq_attr_scaling_available_freqs, - NULL, -}; - static struct cpufreq_driver longhaul_driver = { - .verify = longhaul_verify, + .verify = cpufreq_generic_frequency_table_verify, .target = longhaul_target, .get = longhaul_get, .init = longhaul_cpu_init, - .exit = longhaul_cpu_exit, + .exit = cpufreq_generic_exit, .name = "longhaul", - .attr = longhaul_attr, + .attr = cpufreq_generic_attr, }; static const struct x86_cpu_id longhaul_id[] = { -- cgit v1.2.3 From b1123ea3c3e4874c03daaf8b742f2a12ada5d548 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Thu, 3 Oct 2013 20:28:48 +0530 Subject: cpufreq: longhaul: don't initialize part of policy set by core Many common initializations of struct policy are moved to core now and hence this driver doesn't need to do it. This patch removes such code. Most recent of those changes is to call ->get() in the core after calling ->init(). Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/longhaul.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/cpufreq/longhaul.c') diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index 57d7b02f863a..14df4974fb45 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c @@ -913,7 +913,6 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy) longhaul_setup_voltagescaling(); policy->cpuinfo.transition_latency = 200000; /* nsec */ - policy->cur = calc_speed(longhaul_get_cpu_mult()); return cpufreq_table_validate_and_show(policy, longhaul_table); } -- cgit v1.2.3