Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
[sfrench/cifs-2.6.git] / arch / x86 / kernel / topology.c
index 8caa0b777466218fcb04d4a706ff155588200942..0fcc95a354f7c28d980bf45fffd777c01a3ace25 100644 (file)
 #include <linux/mmzone.h>
 #include <asm/cpu.h>
 
-static struct i386_cpu cpu_devices[NR_CPUS];
+static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
 
-int arch_register_cpu(int num)
+#ifdef CONFIG_HOTPLUG_CPU
+int __ref arch_register_cpu(int num)
 {
        /*
         * CPU0 cannot be offlined due to several
@@ -44,20 +45,22 @@ int arch_register_cpu(int num)
         * Also certain PCI quirks require not to enable hotplug control
         * for all CPU's.
         */
-#ifdef CONFIG_HOTPLUG_CPU
        if (num)
-               cpu_devices[num].cpu.hotpluggable = 1;
-#endif
-
-       return register_cpu(&cpu_devices[num].cpu, num);
+               per_cpu(cpu_devices, num).cpu.hotpluggable = 1;
+       return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
 }
+EXPORT_SYMBOL(arch_register_cpu);
 
-#ifdef CONFIG_HOTPLUG_CPU
-void arch_unregister_cpu(int num) {
-       return unregister_cpu(&cpu_devices[num].cpu);
+void arch_unregister_cpu(int num)
+{
+       unregister_cpu(&per_cpu(cpu_devices, num).cpu);
 }
-EXPORT_SYMBOL(arch_register_cpu);
 EXPORT_SYMBOL(arch_unregister_cpu);
+#else
+static int __init arch_register_cpu(int num)
+{
+       return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
+}
 #endif /*CONFIG_HOTPLUG_CPU*/
 
 static int __init topology_init(void)