diff options
Diffstat (limited to 'drivers/base/cpu.c')
-rw-r--r-- | drivers/base/cpu.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 1d110dc6f0c..a16d20e389f 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -102,7 +102,6 @@ static ssize_t cpu_release_store(struct device *dev, static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store); #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ - #endif /* CONFIG_HOTPLUG_CPU */ struct bus_type cpu_subsys = { @@ -151,7 +150,31 @@ static ssize_t show_crash_notes_size(struct device *dev, return rc; } static DEVICE_ATTR(crash_notes_size, 0400, show_crash_notes_size, NULL); + +static struct attribute *crash_note_cpu_attrs[] = { + &dev_attr_crash_notes.attr, + &dev_attr_crash_notes_size.attr, + NULL +}; + +static struct attribute_group crash_note_cpu_attr_group = { + .attrs = crash_note_cpu_attrs, +}; +#endif + +static const struct attribute_group *common_cpu_attr_groups[] = { +#ifdef CONFIG_KEXEC + &crash_note_cpu_attr_group, +#endif + NULL +}; + +static const struct attribute_group *hotplugable_cpu_attr_groups[] = { +#ifdef CONFIG_KEXEC + &crash_note_cpu_attr_group, #endif + NULL +}; /* * Print cpu online, possible, present, and system maps @@ -269,19 +292,15 @@ int __cpuinit register_cpu(struct cpu *cpu, int num) #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE cpu->dev.bus->uevent = arch_cpu_uevent; #endif + cpu->dev.groups = common_cpu_attr_groups; + if (cpu->hotpluggable) + cpu->dev.groups = hotplugable_cpu_attr_groups; error = device_register(&cpu->dev); if (!error) per_cpu(cpu_sys_devices, num) = &cpu->dev; if (!error) register_cpu_under_node(num, cpu_to_node(num)); -#ifdef CONFIG_KEXEC - if (!error) - error = device_create_file(&cpu->dev, &dev_attr_crash_notes); - if (!error) - error = device_create_file(&cpu->dev, - &dev_attr_crash_notes_size); -#endif return error; } |