Skip to content

Commit

Permalink
arch/sparc/kernel: Use set_cpus_allowed_ptr
Browse files Browse the repository at this point in the history
Use set_cpus_allowed_ptr rather than set_cpus_allowed.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <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: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Julia Lawall authored and David S. Miller committed Mar 28, 2010
1 parent 7469a9a commit d2566af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions arch/sparc/kernel/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ static unsigned long run_on_cpu(unsigned long cpu,
unsigned long ret;

/* should return -EINVAL to userspace */
if (set_cpus_allowed(current, cpumask_of_cpu(cpu)))
if (set_cpus_allowed_ptr(current, cpumask_of(cpu)))
return 0;

ret = func(arg);

set_cpus_allowed(current, old_affinity);
set_cpus_allowed_ptr(current, &old_affinity);

return ret;
}
Expand Down
8 changes: 4 additions & 4 deletions arch/sparc/kernel/us2e_cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ static unsigned int us2e_freq_get(unsigned int cpu)
return 0;

cpus_allowed = current->cpus_allowed;
set_cpus_allowed(current, cpumask_of_cpu(cpu));
set_cpus_allowed_ptr(current, cpumask_of(cpu));

clock_tick = sparc64_get_clock_tick(cpu) / 1000;
estar = read_hbreg(HBIRD_ESTAR_MODE_ADDR);

set_cpus_allowed(current, cpus_allowed);
set_cpus_allowed_ptr(current, &cpus_allowed);

return clock_tick / estar_to_divisor(estar);
}
Expand All @@ -259,7 +259,7 @@ static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index)
return;

cpus_allowed = current->cpus_allowed;
set_cpus_allowed(current, cpumask_of_cpu(cpu));
set_cpus_allowed_ptr(current, cpumask_of(cpu));

new_freq = clock_tick = sparc64_get_clock_tick(cpu) / 1000;
new_bits = index_to_estar_mode(index);
Expand All @@ -281,7 +281,7 @@ static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index)

cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);

set_cpus_allowed(current, cpus_allowed);
set_cpus_allowed_ptr(current, &cpus_allowed);
}

static int us2e_freq_target(struct cpufreq_policy *policy,
Expand Down
8 changes: 4 additions & 4 deletions arch/sparc/kernel/us3_cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ static unsigned int us3_freq_get(unsigned int cpu)
return 0;

cpus_allowed = current->cpus_allowed;
set_cpus_allowed(current, cpumask_of_cpu(cpu));
set_cpus_allowed_ptr(current, cpumask_of(cpu));

reg = read_safari_cfg();
ret = get_current_freq(cpu, reg);

set_cpus_allowed(current, cpus_allowed);
set_cpus_allowed_ptr(current, &cpus_allowed);

return ret;
}
Expand All @@ -106,7 +106,7 @@ static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index)
return;

cpus_allowed = current->cpus_allowed;
set_cpus_allowed(current, cpumask_of_cpu(cpu));
set_cpus_allowed_ptr(current, cpumask_of(cpu));

new_freq = sparc64_get_clock_tick(cpu) / 1000;
switch (index) {
Expand Down Expand Up @@ -140,7 +140,7 @@ static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index)

cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);

set_cpus_allowed(current, cpus_allowed);
set_cpus_allowed_ptr(current, &cpus_allowed);
}

static int us3_freq_target(struct cpufreq_policy *policy,
Expand Down

0 comments on commit d2566af

Please sign in to comment.