All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: rjw@sisk.pl
Cc: linaro-kernel@lists.linaro.org, patches@linaro.org,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Viresh Kumar <viresh.kumar@linaro.org>,
	John Crispin <blogic@openwrt.org>
Subject: [PATCH 09/16] cpufreq: loongson2: use cpufreq_generic_get() routine
Date: Fri, 23 Aug 2013 21:20:44 +0530	[thread overview]
Message-ID: <6b52aaf5430637af26b2948d3ced4ae07580cc01.1377272740.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1377272740.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1377272740.git.viresh.kumar@linaro.org>

We have common infrastructure available with us for getting a CPUs clk rate.
Lets use it for this driver.

We don't need a global variable to hold clock anymore.

Cc: John Crispin <blogic@openwrt.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/loongson2_cpufreq.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
index 6232d29..58a018a 100644
--- a/drivers/cpufreq/loongson2_cpufreq.c
+++ b/drivers/cpufreq/loongson2_cpufreq.c
@@ -24,8 +24,6 @@
 
 static uint nowait;
 
-static struct clk *cpuclk;
-
 static void (*saved_cpu_wait) (void);
 
 static int loongson2_cpu_freq_notifier(struct notifier_block *nb,
@@ -44,11 +42,6 @@ static int loongson2_cpu_freq_notifier(struct notifier_block *nb,
 	return 0;
 }
 
-static unsigned int loongson2_cpufreq_get(unsigned int cpu)
-{
-	return clk_get_rate(cpuclk);
-}
-
 /*
  * Here we notify other drivers of the proposed change and the final change.
  */
@@ -69,13 +62,14 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy,
 	set_cpus_allowed_ptr(current, &cpus_allowed);
 
 	/* setting the cpu frequency */
-	clk_set_rate(cpuclk, freq);
+	clk_set_rate(policy->clk, freq);
 
 	return 0;
 }
 
 static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
 {
+	static struct clk *cpuclk;
 	int i;
 	unsigned long rate;
 	int ret;
@@ -104,6 +98,7 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
 		return ret;
 	}
 
+	policy->clk = cpuclk;
 	return cpufreq_table_validate_and_show(policy,
 					    &loongson2_clockmod_table[0]);
 }
@@ -111,7 +106,7 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
 static int loongson2_cpufreq_exit(struct cpufreq_policy *policy)
 {
 	cpufreq_frequency_table_put_attr(policy->cpu);
-	clk_put(cpuclk);
+	clk_put(policy->clk);
 	return 0;
 }
 
@@ -120,7 +115,7 @@ static struct cpufreq_driver loongson2_cpufreq_driver = {
 	.init = loongson2_cpufreq_cpu_init,
 	.verify = cpufreq_generic_frequency_table_verify,
 	.target_index = loongson2_cpufreq_target,
-	.get = loongson2_cpufreq_get,
+	.get = cpufreq_generic_get,
 	.exit = loongson2_cpufreq_exit,
 	.attr = cpufreq_generic_attr,
 };
-- 
1.7.12.rc2.18.g61b472e


  parent reply	other threads:[~2013-08-23 15:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23 15:50 [PATCH 00/16] cpufreq: create & use cpufreq_generic_get() routine Viresh Kumar
2013-08-23 15:50 ` [PATCH 01/16] cpufreq: create " Viresh Kumar
2013-08-23 15:50 ` [PATCH 02/16] cpufreq: arm_big_little: use " Viresh Kumar
2013-08-23 15:50 ` [PATCH 03/16] cpufreq: at32ap: " Viresh Kumar
2013-08-26  7:12   ` Hans-Christian Egtvedt
2013-08-23 15:50 ` [PATCH 04/16] cpufreq: cpu0: " Viresh Kumar
2013-08-29 13:07   ` Shawn Guo
2013-08-29 13:07     ` Shawn Guo
2013-08-23 15:50 ` [PATCH 05/16] cpufreq: davinci: " Viresh Kumar
2013-08-23 15:50 ` [PATCH 06/16] cpufreq: dbx500: " Viresh Kumar
2013-08-28 12:14   ` Linus Walleij
2013-08-23 15:50 ` [PATCH 07/16] cpufreq: exynos: " Viresh Kumar
2013-08-23 15:50 ` [PATCH 08/16] cpufreq: imx6q: " Viresh Kumar
2013-08-23 15:50 ` Viresh Kumar [this message]
2013-08-23 15:50 ` [PATCH 10/16] cpufreq: omap: " Viresh Kumar
2013-08-23 15:50 ` [PATCH 11/16] cpufreq: ppc: " Viresh Kumar
2013-08-23 15:50 ` [PATCH 12/16] cpufreq: s3c: " Viresh Kumar
2013-08-23 15:50 ` [PATCH 13/16] cpufreq: s5pv210: " Viresh Kumar
2013-08-23 15:50 ` [PATCH 14/16] cpufreq: spear: " Viresh Kumar
2013-08-23 15:50 ` [PATCH 15/16] cpufreq: tegra: " Viresh Kumar
2013-08-23 15:50 ` [PATCH 16/16] cpufreq: unicore2: " Viresh Kumar
2013-08-23 19:40 ` [PATCH 00/16] cpufreq: create & " Rafael J. Wysocki
2013-08-24  4:20   ` Viresh Kumar
2013-08-24 14:50     ` Rafael J. Wysocki
2013-08-26  4:30       ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b52aaf5430637af26b2948d3ced4ae07580cc01.1377272740.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=blogic@openwrt.org \
    --cc=cpufreq@vger.kernel.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.