cpumask: convert other misc kernel functions

Convert other misc kernel functions to use struct cpumask.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 lib/smp_processor_id.c |    2 +-
 virt/kvm/kvm_main.c    |   20 ++++++++++++++------
 2 files changed, 15 insertions(+), 7 deletions(-)

--- linux-2.6.28.orig/lib/smp_processor_id.c
+++ linux-2.6.28/lib/smp_processor_id.c
@@ -22,7 +22,7 @@ notrace unsigned int debug_smp_processor
 	 * Kernel threads bound to a single CPU can safely use
 	 * smp_processor_id():
 	 */
-	if (cpus_equal(current->cpus_allowed, cpumask_of_cpu(this_cpu)))
+	if (cpumask_equal(&current->cpus_allowed, cpumask_of(this_cpu)))
 		goto out;
 
 	/*
--- linux-2.6.28.orig/virt/kvm/kvm_main.c
+++ linux-2.6.28/virt/kvm/kvm_main.c
@@ -63,7 +63,7 @@ MODULE_LICENSE("GPL");
 DEFINE_SPINLOCK(kvm_lock);
 LIST_HEAD(vm_list);
 
-static cpumask_t cpus_hardware_enabled;
+static cpumask_var_t cpus_hardware_enabled;
 
 struct kmem_cache *kvm_vcpu_cache;
 EXPORT_SYMBOL_GPL(kvm_vcpu_cache);
@@ -1792,9 +1792,9 @@ static void hardware_enable(void *junk)
 {
 	int cpu = raw_smp_processor_id();
 
-	if (cpu_isset(cpu, cpus_hardware_enabled))
+	if (cpumask_test_cpu(cpu, cpus_hardware_enabled))
 		return;
-	cpu_set(cpu, cpus_hardware_enabled);
+	cpumask_set_cpu(cpu, cpus_hardware_enabled);
 	kvm_arch_hardware_enable(NULL);
 }
 
@@ -1802,9 +1802,9 @@ static void hardware_disable(void *junk)
 {
 	int cpu = raw_smp_processor_id();
 
-	if (!cpu_isset(cpu, cpus_hardware_enabled))
+	if (!cpumask_test_cpu(cpu, cpus_hardware_enabled))
 		return;
-	cpu_clear(cpu, cpus_hardware_enabled);
+	cpumask_clear_cpu(cpu, cpus_hardware_enabled);
 	kvm_arch_hardware_disable(NULL);
 }
 
@@ -2023,11 +2023,16 @@ int kvm_init(void *opaque, unsigned int 
 	int r;
 	int cpu;
 
+	if (!alloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) {
+		r = -ENOMEM;
+		goto out_fail;
+	}
+
 	kvm_init_debug();
 
 	r = kvm_arch_init(opaque);
 	if (r)
-		goto out_fail;
+		goto out_freecpumask;
 
 	bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
 
@@ -2104,6 +2109,8 @@ out_free_0:
 out:
 	kvm_arch_exit();
 	kvm_exit_debug();
+out_freecpumask:
+	free_cpumask_var(cpus_hardware_enabled);
 out_fail:
 	return r;
 }
@@ -2122,6 +2129,7 @@ void kvm_exit(void)
 	kvm_arch_hardware_unsetup();
 	kvm_arch_exit();
 	kvm_exit_debug();
+	free_cpumask_var(cpus_hardware_enabled);
 	__free_page(bad_page);
 }
 EXPORT_SYMBOL_GPL(kvm_exit);
