aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@hutch.davemloft.net>2007-06-02 17:41:44 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-06-05 00:49:50 -0400
commiteff3414b7277c4792debfa227f5408238d925f16 (patch)
tree6c68bbd22f14e8cfa42f4e2f5a18952086156321 /arch
parent5ecd3100e695228ac5e0ce0e325e252c0f11806f (diff)
[SPARC64]: Move topology init code into new file, sysfs.c
Also, use per-cpu data for struct cpu. Calling kmalloc for each cpu in topology_init() is just plain clumsy. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc64/kernel/Makefile4
-rw-r--r--arch/sparc64/kernel/setup.c19
-rw-r--r--arch/sparc64/kernel/sysfs.c26
3 files changed, 28 insertions, 21 deletions
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index d8d19093d12f..f964bf28d21a 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -1,4 +1,4 @@
1# $Id: Makefile,v 1.70 2002/02/09 19:49:30 davem Exp $ 1#
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
@@ -8,7 +8,7 @@ EXTRA_CFLAGS := -Werror
8extra-y := head.o init_task.o vmlinux.lds 8extra-y := head.o init_task.o vmlinux.lds
9 9
10obj-y := process.o setup.o cpu.o idprom.o \ 10obj-y := process.o setup.o cpu.o idprom.o \
11 traps.o auxio.o una_asm.o \ 11 traps.o auxio.o una_asm.o sysfs.o \
12 irq.o ptrace.o time.o sys_sparc.o signal.o \ 12 irq.o ptrace.o time.o sys_sparc.o signal.o \
13 unaligned.o central.o pci.o starfire.o semaphore.o \ 13 unaligned.o central.o pci.o starfire.o semaphore.o \
14 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \ 14 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index de9b4c13f1c7..7490cc670a53 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -513,22 +513,3 @@ void sun_do_break(void)
513 513
514int serial_console = -1; 514int serial_console = -1;
515int stop_a_enabled = 1; 515int stop_a_enabled = 1;
516
517static int __init topology_init(void)
518{
519 int i, err;
520
521 err = -ENOMEM;
522
523 for_each_possible_cpu(i) {
524 struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
525 if (p) {
526 register_cpu(p, i);
527 err = 0;
528 }
529 }
530
531 return err;
532}
533
534subsys_initcall(topology_init);
diff --git a/arch/sparc64/kernel/sysfs.c b/arch/sparc64/kernel/sysfs.c
new file mode 100644
index 000000000000..0808c214dc73
--- /dev/null
+++ b/arch/sparc64/kernel/sysfs.c
@@ -0,0 +1,26 @@
1/* sysfs.c: Toplogy sysfs support code for sparc64.
2 *
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
4 */
5#include <linux/sysdev.h>
6#include <linux/cpu.h>
7#include <linux/smp.h>
8#include <linux/percpu.h>
9#include <linux/init.h>
10
11static DEFINE_PER_CPU(struct cpu, cpu_devices);
12
13static int __init topology_init(void)
14{
15 int cpu;
16
17 for_each_possible_cpu(cpu) {
18 struct cpu *c = &per_cpu(cpu_devices, cpu);
19
20 register_cpu(c, cpu);
21 }
22
23 return 0;
24}
25
26subsys_initcall(topology_init);