diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/Kconfig | 4 | ||||
-rw-r--r-- | drivers/base/base.h | 2 | ||||
-rw-r--r-- | drivers/base/cpu.c | 30 |
3 files changed, 28 insertions, 8 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/base.h b/drivers/base/base.h index 7a6ae4228761..b858dfd9a37c 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h @@ -94,7 +94,7 @@ extern int hypervisor_init(void); static inline int hypervisor_init(void) { return 0; } #endif extern int platform_bus_init(void); -extern int cpu_dev_init(void); +extern void cpu_dev_init(void); extern int bus_add_device(struct device *dev); extern void bus_probe_device(struct device *dev); diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 9a5578efbc93..db87e78d7459 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -2,6 +2,7 @@ * CPU subsystem support */ +#include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/sched.h> @@ -10,6 +11,7 @@ #include <linux/device.h> #include <linux/node.h> #include <linux/gfp.h> +#include <linux/percpu.h> #include "base.h" @@ -274,16 +276,30 @@ bool cpu_is_hotpluggable(unsigned cpu) } EXPORT_SYMBOL_GPL(cpu_is_hotpluggable); -int __init cpu_dev_init(void) +#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) { - int err; + if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups)) + panic("Failed to register CPU subsystem"); - err = subsys_system_register(&cpu_subsys, cpu_root_attr_groups); - if (err) - return err; + cpu_dev_register_generic(); #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) - err = sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root); + sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root); #endif - return err; } |