]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
sh: Split out CPU topology initialization.
authorPaul Mundt <lethal@linux-sh.org>
Mon, 14 May 2007 03:50:43 +0000 (12:50 +0900)
committerPaul Mundt <lethal@hera.kernel.org>
Fri, 8 Jun 2007 02:43:35 +0000 (02:43 +0000)
Split out the CPU topology initialization to a separate file,
and switch it to a percpu type, rather than an NR_CPUS array.

At the same time, switch to only registering present CPUs,
rather than using the possible CPU map.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/kernel/Makefile
arch/sh/kernel/setup.c
arch/sh/kernel/topology.c [new file with mode: 0644]

index 9104b6257644dbcb2cff22d38f475f038c89656c..fb623e5d18571373f3a26efa352e919f1f6e2085 100644 (file)
@@ -4,10 +4,9 @@
 
 extra-y        := head.o init_task.o vmlinux.lds
 
-obj-y  := process.o signal.o traps.o irq.o \
-       ptrace.o setup.o time.o sys_sh.o semaphore.o \
-       io.o io_generic.o sh_ksyms.o syscalls.o \
-       debugtraps.o
+obj-y  := debugtraps.o io.o io_generic.o irq.o process.o ptrace.o \
+          semaphore.o setup.o signal.o sys_sh.o syscalls.o \
+          time.o topology.o traps.o
 
 obj-y                          += cpu/ timers/
 obj-$(CONFIG_VSYSCALL)         += vsyscall/
@@ -17,7 +16,7 @@ obj-$(CONFIG_CF_ENABLER)      += cf-enabler.o
 obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
 obj-$(CONFIG_SH_KGDB)          += kgdb_stub.o kgdb_jmp.o
 obj-$(CONFIG_SH_CPU_FREQ)      += cpufreq.o
-obj-$(CONFIG_MODULES)          += module.o
+obj-$(CONFIG_MODULES)          += sh_ksyms.o module.o
 obj-$(CONFIG_EARLY_PRINTK)     += early_printk.o
 obj-$(CONFIG_KEXEC)            += machine_kexec.o relocate_kernel.o
 obj-$(CONFIG_CRASH_DUMP)       += crash_dump.o
index c27729135935d77a8a4387fdb562e3bb86158357..61152b4383253118fcdf3230a2159f5b38e44b4f 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/kexec.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
+#include <asm/page.h>
 #include <asm/sections.h>
 #include <asm/irq.h>
 #include <asm/setup.h>
@@ -389,20 +390,6 @@ struct sh_machine_vector* __init get_mv_byname(const char* name)
        return NULL;
 }
 
-static struct cpu cpu[NR_CPUS];
-
-static int __init topology_init(void)
-{
-       int cpu_id;
-
-       for_each_possible_cpu(cpu_id)
-               register_cpu(&cpu[cpu_id], cpu_id);
-
-       return 0;
-}
-
-subsys_initcall(topology_init);
-
 static const char *cpu_name[] = {
        [CPU_SH7206]    = "SH7206",     [CPU_SH7619]    = "SH7619",
        [CPU_SH7604]    = "SH7604",     [CPU_SH7300]    = "SH7300",
diff --git a/arch/sh/kernel/topology.c b/arch/sh/kernel/topology.c
new file mode 100644 (file)
index 0000000..8a4664c
--- /dev/null
@@ -0,0 +1,21 @@
+#include <linux/cpu.h>
+#include <linux/cpumask.h>
+#include <linux/init.h>
+#include <linux/percpu.h>
+
+static DEFINE_PER_CPU(struct cpu, cpu_devices);
+
+static int __init topology_init(void)
+{
+       int i, ret;
+
+       for_each_present_cpu(i) {
+               ret = register_cpu(&per_cpu(cpu_devices, i), i);
+               if (unlikely(ret))
+                       printk(KERN_WARNING "%s: register_cpu %d failed (%d)\n",
+                              __FUNCTION__, i, ret);
+       }
+
+       return 0;
+}
+subsys_initcall(topology_init);