public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: integrator: Use set_cpus_allowed_ptr
@ 2014-08-03 10:15 Himangi Saraogi
  2014-08-04  7:22 ` Viresh Kumar
  0 siblings, 1 reply; 2+ messages in thread
From: Himangi Saraogi @ 2014-08-03 10:15 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, linux-pm, linux-kernel; +Cc: Julia Lawall

Several years ago there was an effort to convert all uses of
set_cpus_allowed to use set_cpus_allowed_ptr with the goal of eventually
removing the current definition of set_cpus_allowed and renaming
set_cpus_allowed_ptr as set_cpus_allowed
(https://lkml.org/lkml/2010/3/26/59). This is another step in this
direction.

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@@
expression E1,E2;
@@

- set_cpus_allowed(E1, cpumask_of_cpu(E2))
+ set_cpus_allowed_ptr(E1, cpumask_of(E2))

@@
expression E;
identifier I;
@@

- set_cpus_allowed(E, I)
+ set_cpus_allowed_ptr(E, &I)
// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
---
 drivers/cpufreq/integrator-cpufreq.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/integrator-cpufreq.c b/drivers/cpufreq/integrator-cpufreq.c
index e5122f1..c132052 100644
--- a/drivers/cpufreq/integrator-cpufreq.c
+++ b/drivers/cpufreq/integrator-cpufreq.c
@@ -92,7 +92,7 @@ static int integrator_set_target(struct cpufreq_policy *policy,
 	 * Bind to the specified CPU.  When this call returns,
 	 * we should be running on the right CPU.
 	 */
-	set_cpus_allowed(current, cpumask_of_cpu(cpu));
+	set_cpus_allowed_ptr(current, cpumask_of(cpu));
 	BUG_ON(cpu != smp_processor_id());
 
 	/* get current setting */
@@ -118,7 +118,7 @@ static int integrator_set_target(struct cpufreq_policy *policy,
 	freqs.new = icst_hz(&cclk_params, vco) / 1000;
 
 	if (freqs.old == freqs.new) {
-		set_cpus_allowed(current, cpus_allowed);
+		set_cpus_allowed_ptr(current, &cpus_allowed);
 		return 0;
 	}
 
@@ -141,7 +141,7 @@ static int integrator_set_target(struct cpufreq_policy *policy,
 	/*
 	 * Restore the CPUs allowed mask.
 	 */
-	set_cpus_allowed(current, cpus_allowed);
+	set_cpus_allowed_ptr(current, &cpus_allowed);
 
 	cpufreq_freq_transition_end(policy, &freqs, 0);
 
@@ -157,7 +157,7 @@ static unsigned int integrator_get(unsigned int cpu)
 
 	cpus_allowed = current->cpus_allowed;
 
-	set_cpus_allowed(current, cpumask_of_cpu(cpu));
+	set_cpus_allowed_ptr(current, cpumask_of(cpu));
 	BUG_ON(cpu != smp_processor_id());
 
 	/* detect memory etc. */
@@ -173,7 +173,7 @@ static unsigned int integrator_get(unsigned int cpu)
 
 	current_freq = icst_hz(&cclk_params, vco) / 1000; /* current freq */
 
-	set_cpus_allowed(current, cpus_allowed);
+	set_cpus_allowed_ptr(current, &cpus_allowed);
 
 	return current_freq;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cpufreq: integrator: Use set_cpus_allowed_ptr
  2014-08-03 10:15 [PATCH] cpufreq: integrator: Use set_cpus_allowed_ptr Himangi Saraogi
@ 2014-08-04  7:22 ` Viresh Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2014-08-04  7:22 UTC (permalink / raw)
  To: Himangi Saraogi
  Cc: Rafael J. Wysocki, linux-pm@vger.kernel.org,
	Linux Kernel Mailing List, Julia Lawall

On 3 August 2014 15:45, Himangi Saraogi <himangi774@gmail.com> wrote:
> Several years ago there was an effort to convert all uses of
> set_cpus_allowed to use set_cpus_allowed_ptr with the goal of eventually
> removing the current definition of set_cpus_allowed and renaming
> set_cpus_allowed_ptr as set_cpus_allowed
> (https://lkml.org/lkml/2010/3/26/59). This is another step in this
> direction.
>
> The Coccinelle semantic patch that makes this change is as follows:
>
> // <smpl>
> @@
> expression E1,E2;
> @@
>
> - set_cpus_allowed(E1, cpumask_of_cpu(E2))
> + set_cpus_allowed_ptr(E1, cpumask_of(E2))
>
> @@
> expression E;
> identifier I;
> @@
>
> - set_cpus_allowed(E, I)
> + set_cpus_allowed_ptr(E, &I)
> // </smpl>
>
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>
> ---
>  drivers/cpufreq/integrator-cpufreq.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/cpufreq/integrator-cpufreq.c b/drivers/cpufreq/integrator-cpufreq.c
> index e5122f1..c132052 100644
> --- a/drivers/cpufreq/integrator-cpufreq.c
> +++ b/drivers/cpufreq/integrator-cpufreq.c
> @@ -92,7 +92,7 @@ static int integrator_set_target(struct cpufreq_policy *policy,
>          * Bind to the specified CPU.  When this call returns,
>          * we should be running on the right CPU.
>          */
> -       set_cpus_allowed(current, cpumask_of_cpu(cpu));
> +       set_cpus_allowed_ptr(current, cpumask_of(cpu));
>         BUG_ON(cpu != smp_processor_id());
>
>         /* get current setting */
> @@ -118,7 +118,7 @@ static int integrator_set_target(struct cpufreq_policy *policy,
>         freqs.new = icst_hz(&cclk_params, vco) / 1000;
>
>         if (freqs.old == freqs.new) {
> -               set_cpus_allowed(current, cpus_allowed);
> +               set_cpus_allowed_ptr(current, &cpus_allowed);
>                 return 0;
>         }
>
> @@ -141,7 +141,7 @@ static int integrator_set_target(struct cpufreq_policy *policy,
>         /*
>          * Restore the CPUs allowed mask.
>          */
> -       set_cpus_allowed(current, cpus_allowed);
> +       set_cpus_allowed_ptr(current, &cpus_allowed);
>
>         cpufreq_freq_transition_end(policy, &freqs, 0);
>
> @@ -157,7 +157,7 @@ static unsigned int integrator_get(unsigned int cpu)
>
>         cpus_allowed = current->cpus_allowed;
>
> -       set_cpus_allowed(current, cpumask_of_cpu(cpu));
> +       set_cpus_allowed_ptr(current, cpumask_of(cpu));
>         BUG_ON(cpu != smp_processor_id());
>
>         /* detect memory etc. */
> @@ -173,7 +173,7 @@ static unsigned int integrator_get(unsigned int cpu)
>
>         current_freq = icst_hz(&cclk_params, vco) / 1000; /* current freq */
>
> -       set_cpus_allowed(current, cpus_allowed);
> +       set_cpus_allowed_ptr(current, &cpus_allowed);
>
>         return current_freq;
>  }

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-04  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-03 10:15 [PATCH] cpufreq: integrator: Use set_cpus_allowed_ptr Himangi Saraogi
2014-08-04  7:22 ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox