Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a302a96 authored by Paul Mundt's avatar Paul Mundt Committed by Paul Mundt
Browse files

sh: Split out CPU topology initialization.



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: default avatarPaul Mundt <lethal@linux-sh.org>
parent 85f6038f
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -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
+1 −14
Original line number Diff line number Diff line
@@ -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",
+21 −0
Original line number Diff line number Diff line
#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);