All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Rafael Wysocki <rjw@rjwysocki.net>, yuantian.tang@freescale.com
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
	hongbo.zhang@freescale.com, leoli@freescale.com,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH 2/2] cpufreq: ppc-corenet: remove per-cpu variable 'cpu_mask'
Date: Tue,  2 Sep 2014 09:11:25 +0530	[thread overview]
Message-ID: <3d467a39ab1b96dc24ed8a71139d5e030239477f.1409629117.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <09092df3d8b03df99ee475357c5f5c9cc439c61c.1409629117.git.viresh.kumar@linaro.org>
In-Reply-To: <09092df3d8b03df99ee475357c5f5c9cc439c61c.1409629117.git.viresh.kumar@linaro.org>

We are copying cpu_core_mask(cpu) in a per-cpu local variable: 'cpu_mask'. There
is no need of doing this and can be replaced by a call to cpu_core_mask().

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/ppc-corenet-cpufreq.c | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c
index bee5df7..dbcac39 100644
--- a/drivers/cpufreq/ppc-corenet-cpufreq.c
+++ b/drivers/cpufreq/ppc-corenet-cpufreq.c
@@ -69,9 +69,6 @@ static const u32 *fmask;
 
 static DEFINE_PER_CPU(struct cpu_data *, cpu_data);
 
-/* cpumask in a cluster */
-static DEFINE_PER_CPU(cpumask_var_t, cpu_mask);
-
 #ifndef CONFIG_SMP
 static inline const struct cpumask *cpu_core_mask(int cpu)
 {
@@ -201,8 +198,8 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	data->table = table;
 
 	/* update ->cpus if we have cluster, no harm if not */
-	cpumask_copy(policy->cpus, per_cpu(cpu_mask, cpu));
-	for_each_cpu(i, per_cpu(cpu_mask, cpu))
+	cpumask_copy(policy->cpus, cpu_core_mask(cpu));
+	for_each_cpu(i, cpu_core_mask(cpu))
 		per_cpu(cpu_data, i) = data;
 
 	/* Minimum transition latency is 12 platform clocks */
@@ -236,7 +233,7 @@ static int __exit corenet_cpufreq_cpu_exit(struct cpufreq_policy *policy)
 	kfree(data->table);
 	kfree(data);
 
-	for_each_cpu(cpu, per_cpu(cpu_mask, policy->cpu))
+	for_each_cpu(cpu, cpu_core_mask(policy->cpu))
 		per_cpu(cpu_data, cpu) = NULL;
 
 	return 0;
@@ -285,12 +282,6 @@ static int __init ppc_corenet_cpufreq_init(void)
 	if (!np)
 		return -ENODEV;
 
-	for_each_possible_cpu(cpu) {
-		if (!alloc_cpumask_var(&per_cpu(cpu_mask, cpu), GFP_KERNEL))
-			goto err_mask;
-		cpumask_copy(per_cpu(cpu_mask, cpu), cpu_core_mask(cpu));
-	}
-
 	match = of_match_node(node_matches, np);
 	data = match->data;
 	if (data) {
@@ -308,22 +299,11 @@ static int __init ppc_corenet_cpufreq_init(void)
 		pr_info("Freescale PowerPC corenet CPU frequency scaling driver\n");
 
 	return ret;
-
-err_mask:
-	for_each_possible_cpu(cpu)
-		free_cpumask_var(per_cpu(cpu_mask, cpu));
-
-	return -ENOMEM;
 }
 module_init(ppc_corenet_cpufreq_init);
 
 static void __exit ppc_corenet_cpufreq_exit(void)
 {
-	unsigned int cpu;
-
-	for_each_possible_cpu(cpu)
-		free_cpumask_var(per_cpu(cpu_mask, cpu));
-
 	cpufreq_unregister_driver(&ppc_corenet_cpufreq_driver);
 }
 module_exit(ppc_corenet_cpufreq_exit);
-- 
2.0.3.693.g996b0fd


  reply	other threads:[~2014-09-02  3:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02  3:41 [PATCH 1/2] cpufreq: ppc-corenet: remove duplicate update of cpu_data Viresh Kumar
2014-09-02  3:41 ` Viresh Kumar [this message]
2014-09-02  6:46   ` [PATCH 2/2] cpufreq: ppc-corenet: remove per-cpu variable 'cpu_mask' Yuantian Tang
2014-09-02  6:49     ` Viresh Kumar
2014-09-02  7:02       ` Yuantian Tang
2014-09-02  7:09         ` Viresh Kumar
2014-09-02  8:08           ` Yuantian Tang
2014-09-03  8:02           ` Yuantian Tang
2014-09-03  9:50             ` Viresh Kumar
2014-09-04  2:51               ` Yuantian Tang
2014-09-04  3:38                 ` Viresh Kumar
2014-09-04  4:33                   ` Yuantian Tang
2014-09-04  4:37                     ` Viresh Kumar
2014-09-05  9:35                       ` Yuantian Tang
2014-09-05  9:40                         ` Viresh Kumar
2014-09-02  6:38 ` [PATCH 1/2] cpufreq: ppc-corenet: remove duplicate update of cpu_data Yuantian Tang
2014-09-02  6:47   ` Viresh Kumar
2014-09-10  4:32 ` Viresh Kumar
2014-09-10  5:30   ` Yuantian Tang
2014-09-10  5:39     ` Viresh Kumar
2014-09-10  6:19       ` Yuantian Tang
2014-09-10  6:20 ` Yuantian Tang
2014-09-24 23:45 ` Rafael J. Wysocki
2014-09-29  9:05   ` Viresh Kumar
2014-09-29 23:41     ` Rafael J. Wysocki

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=3d467a39ab1b96dc24ed8a71139d5e030239477f.1409629117.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=hongbo.zhang@freescale.com \
    --cc=leoli@freescale.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=yuantian.tang@freescale.com \
    /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.