提交 5cb0535f 编写于 作者: R Rusty Russell 提交者: Ingo Molnar

cpumask: replace CPUMASK_ALLOC etc with cpumask_var_t

Impact: cleanup

There's only one user, and it's a fairly easy conversion.
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: NMike Travis <travis@sgi.com>
Acked-by: NDave Jones <davej@redhat.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 d12418fd
...@@ -458,11 +458,6 @@ static int centrino_verify (struct cpufreq_policy *policy) ...@@ -458,11 +458,6 @@ static int centrino_verify (struct cpufreq_policy *policy)
* *
* Sets a new CPUFreq policy. * Sets a new CPUFreq policy.
*/ */
struct allmasks {
cpumask_t saved_mask;
cpumask_t covered_cpus;
};
static int centrino_target (struct cpufreq_policy *policy, static int centrino_target (struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation) unsigned int relation)
...@@ -472,12 +467,15 @@ static int centrino_target (struct cpufreq_policy *policy, ...@@ -472,12 +467,15 @@ static int centrino_target (struct cpufreq_policy *policy,
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
int retval = 0; int retval = 0;
unsigned int j, k, first_cpu, tmp; unsigned int j, k, first_cpu, tmp;
CPUMASK_ALLOC(allmasks); cpumask_var_t saved_mask, covered_cpus;
CPUMASK_PTR(saved_mask, allmasks);
CPUMASK_PTR(covered_cpus, allmasks);
if (unlikely(allmasks == NULL)) if (unlikely(!alloc_cpumask_var(&saved_mask, GFP_KERNEL)))
return -ENOMEM; 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)) { if (unlikely(per_cpu(centrino_model, cpu) == NULL)) {
retval = -ENODEV; retval = -ENODEV;
...@@ -493,9 +491,7 @@ static int centrino_target (struct cpufreq_policy *policy, ...@@ -493,9 +491,7 @@ static int centrino_target (struct cpufreq_policy *policy,
goto out; goto out;
} }
*saved_mask = current->cpus_allowed;
first_cpu = 1; first_cpu = 1;
cpus_clear(*covered_cpus);
for_each_cpu_mask_nr(j, policy->cpus) { for_each_cpu_mask_nr(j, policy->cpus) {
const cpumask_t *mask; const cpumask_t *mask;
...@@ -605,7 +601,8 @@ static int centrino_target (struct cpufreq_policy *policy, ...@@ -605,7 +601,8 @@ static int centrino_target (struct cpufreq_policy *policy,
preempt_enable(); preempt_enable();
set_cpus_allowed_ptr(current, saved_mask); set_cpus_allowed_ptr(current, saved_mask);
out: out:
CPUMASK_FREE(allmasks); free_cpumask_var(saved_mask);
free_cpumask_var(covered_cpus);
return retval; return retval;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册