diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2012-01-10 03:04:32 +0000 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 15:50:11 -0800 |
commit | 9f13a1fd452f11c18004ba2422a6384b424ec8a9 (patch) | |
tree | 6aa799a5e095f8cfa03c7386e6d0a20ebda595e4 /drivers/base | |
parent | 024f78462c3da710642a54939888a92e28704653 (diff) | |
download | talos-obmc-linux-9f13a1fd452f11c18004ba2422a6384b424ec8a9.tar.gz talos-obmc-linux-9f13a1fd452f11c18004ba2422a6384b424ec8a9.zip |
cpu: Register a generic CPU device on architectures that currently do not
frv, h8300, m68k, microblaze, openrisc, score, um and xtensa currently
do not register a CPU device. Add the config option GENERIC_CPU_DEVICES
which causes a generic CPU device to be registered for each present CPU,
and make all these architectures select it.
Richard Weinberger <richard@nod.at> covered UML and suggested using
per_cpu.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/Kconfig | 4 | ||||
-rw-r--r-- | drivers/base/cpu.c | 19 |
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index e95c67edb2cb..fcbec8ac134d 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -172,6 +172,10 @@ config SYS_HYPERVISOR bool default n +config GENERIC_CPU_DEVICES + bool + default n + source "drivers/base/regmap/Kconfig" config DMA_SHARED_BUFFER diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index bba70d08be6a..db87e78d7459 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -11,6 +11,7 @@ #include <linux/device.h> #include <linux/node.h> #include <linux/gfp.h> +#include <linux/percpu.h> #include "base.h" @@ -275,11 +276,29 @@ bool cpu_is_hotpluggable(unsigned cpu) } EXPORT_SYMBOL_GPL(cpu_is_hotpluggable); +#ifdef CONFIG_GENERIC_CPU_DEVICES +static DEFINE_PER_CPU(struct cpu, cpu_devices); +#endif + +static void __init cpu_dev_register_generic(void) +{ +#ifdef CONFIG_GENERIC_CPU_DEVICES + int i; + + for_each_possible_cpu(i) { + if (register_cpu(&per_cpu(cpu_devices, i), i)) + panic("Failed to register CPU device"); + } +#endif +} + void __init cpu_dev_init(void) { if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups)) panic("Failed to register CPU subsystem"); + cpu_dev_register_generic(); + #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root); #endif |