Skip to content

Commit

Permalink
cpumask: replace CPUMASK_ALLOC etc with cpumask_var_t
Browse files Browse the repository at this point in the history
Impact: cleanup

There's only one user, and it's a fairly easy conversion.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Acked-by: Dave Jones <davej@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Rusty Russell authored and Ingo Molnar committed Jan 6, 2009
1 parent d12418f commit 5cb0535
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,6 @@ static int centrino_verify (struct cpufreq_policy *policy)
*
* Sets a new CPUFreq policy.
*/
struct allmasks {
cpumask_t saved_mask;
cpumask_t covered_cpus;
};

static int centrino_target (struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int relation)
Expand All @@ -472,12 +467,15 @@ static int centrino_target (struct cpufreq_policy *policy,
struct cpufreq_freqs freqs;
int retval = 0;
unsigned int j, k, first_cpu, tmp;
CPUMASK_ALLOC(allmasks);
CPUMASK_PTR(saved_mask, allmasks);
CPUMASK_PTR(covered_cpus, allmasks);
cpumask_var_t saved_mask, covered_cpus;

if (unlikely(allmasks == NULL))
if (unlikely(!alloc_cpumask_var(&saved_mask, GFP_KERNEL)))
return -ENOMEM;
if (unlikely(!alloc_cpumask_var(&covered_cpus, GFP_KERNEL))) {
free_cpumask_var(saved_mask);
return -ENOMEM;
}
cpumask_copy(saved_mask, &current->cpus_allowed);

if (unlikely(per_cpu(centrino_model, cpu) == NULL)) {
retval = -ENODEV;
Expand All @@ -493,9 +491,7 @@ static int centrino_target (struct cpufreq_policy *policy,
goto out;
}

*saved_mask = current->cpus_allowed;
first_cpu = 1;
cpus_clear(*covered_cpus);
for_each_cpu_mask_nr(j, policy->cpus) {
const cpumask_t *mask;

Expand Down Expand Up @@ -605,7 +601,8 @@ static int centrino_target (struct cpufreq_policy *policy,
preempt_enable();
set_cpus_allowed_ptr(current, saved_mask);
out:
CPUMASK_FREE(allmasks);
free_cpumask_var(saved_mask);
free_cpumask_var(covered_cpus);
return retval;
}

Expand Down

0 comments on commit 5cb0535

Please sign in to comment.