Re: [PATCH 3/5] cpumask: convert misc driver functions

From: Rusty Russell
Date: Sat Jan 10 2009 - 05:58:03 EST


On Thursday 08 January 2009 06:28:35 Mike Travis wrote:
> From: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
>
> Impact: use new cpumask API.
>
> Convert misc driver functions to use struct cpumask.
...
> @@ -593,15 +592,20 @@ static int __cpuinit iucv_cpu_notify(str
> break;
> case CPU_DOWN_PREPARE:
> case CPU_DOWN_PREPARE_FROZEN:
> - cpumask = iucv_buffer_cpumask;
> - cpu_clear(cpu, cpumask);
> - if (cpus_empty(cpumask))
> + if (!alloc_cpumask_var(&cpumask, GFP_KERNEL))
> + return NOTIFY_BAD;
> + cpumask_copy(cpumask, &iucv_buffer_cpumask);
> + cpumask_clear_cpu(cpu, cpumask);
> + if (cpumask_empty(cpumask)) {
> /* Can't offline last IUCV enabled cpu. */
> + free_cpumask_var(cpumask);
> return NOTIFY_BAD;
> + }
> smp_call_function_single(cpu, iucv_retrieve_cpu, NULL, 1);
> if (cpus_empty(iucv_irq_cpumask))
> smp_call_function_single(first_cpu(iucv_buffer_cpumask),
> iucv_allow_cpu, NULL, 1);
> + free_cpumask_var(cpumask);
> break;

Minor nit: this can be done better, actually:

@@ -596,9 +594,7 @@ static int __cpuinit iucv_cpu_notify(str
case CPU_DOWN_PREPARE_FROZEN:
if (!iucv_path_table)
break;
- cpumask = iucv_buffer_cpumask;
- cpu_clear(cpu, cpumask);
- if (cpus_empty(cpumask))
+ if (cpumask_any_but(&iucv_buffer_cpumask, cpu) >= nr_cpu_ids)
/* Can't offline last IUCV enabled cpu. */
return NOTIFY_BAD;
smp_call_function_single(cpu, iucv_retrieve_cpu, NULL, 1);

Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/