diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2012-01-09 22:04:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 18:50:11 -0500 |
commit | 9f13a1fd452f11c18004ba2422a6384b424ec8a9 (patch) | |
tree | 6aa799a5e095f8cfa03c7386e6d0a20ebda595e4 /drivers/base/cpu.c | |
parent | 024f78462c3da710642a54939888a92e28704653 (diff) |
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/cpu.c')
-rw-r--r-- | drivers/base/cpu.c | 19 |
1 files changed, 19 insertions, 0 deletions
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 @@ | |||
11 | #include <linux/device.h> | 11 | #include <linux/device.h> |
12 | #include <linux/node.h> | 12 | #include <linux/node.h> |
13 | #include <linux/gfp.h> | 13 | #include <linux/gfp.h> |
14 | #include <linux/percpu.h> | ||
14 | 15 | ||
15 | #include "base.h" | 16 | #include "base.h" |
16 | 17 | ||
@@ -275,11 +276,29 @@ bool cpu_is_hotpluggable(unsigned cpu) | |||
275 | } | 276 | } |
276 | EXPORT_SYMBOL_GPL(cpu_is_hotpluggable); | 277 | EXPORT_SYMBOL_GPL(cpu_is_hotpluggable); |
277 | 278 | ||
279 | #ifdef CONFIG_GENERIC_CPU_DEVICES | ||
280 | static DEFINE_PER_CPU(struct cpu, cpu_devices); | ||
281 | #endif | ||
282 | |||
283 | static void __init cpu_dev_register_generic(void) | ||
284 | { | ||
285 | #ifdef CONFIG_GENERIC_CPU_DEVICES | ||
286 | int i; | ||
287 | |||
288 | for_each_possible_cpu(i) { | ||
289 | if (register_cpu(&per_cpu(cpu_devices, i), i)) | ||
290 | panic("Failed to register CPU device"); | ||
291 | } | ||
292 | #endif | ||
293 | } | ||
294 | |||
278 | void __init cpu_dev_init(void) | 295 | void __init cpu_dev_init(void) |
279 | { | 296 | { |
280 | if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups)) | 297 | if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups)) |
281 | panic("Failed to register CPU subsystem"); | 298 | panic("Failed to register CPU subsystem"); |
282 | 299 | ||
300 | cpu_dev_register_generic(); | ||
301 | |||
283 | #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) | 302 | #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) |
284 | sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root); | 303 | sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root); |
285 | #endif | 304 | #endif |