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 = {
+ .name = "cpu",
+ .dev_name = "cpu",
+ .match = cpu_subsys_match,
+#ifdef CONFIG_HOTPLUG_CPU
+ .online = cpu_subsys_online,
+ .offline = cpu_subsys_offline,
+#endif
+};
+EXPORT_SYMBOL_GPL(cpu_subsys);
+
#ifdef CONFIG_KEXEC
#include <linux/kexec.h>
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 *hotplugable_cpu_attr_groups[] = {
-#ifdef CONFIG_KEXEC
- &crash_note_cpu_attr_group,
-#endif
-#ifdef CONFIG_HOTPLUG_CPU
- &hotplug_cpu_attr_group,
-#endif
- NULL
-};
-
+ static const struct attribute_group *common_cpu_attr_groups[] = {
+ #ifdef CONFIG_KEXEC
+ &crash_note_cpu_attr_group,
+ #endif
+ NULL
+ };
+
/*
* Print cpu online, possible, present, and system maps
*/
#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
cpu->dev.bus->uevent = arch_cpu_uevent;
#endif
- if (cpu->hotpluggable)
- cpu->dev.groups = hotplugable_cpu_attr_groups;
+ cpu->dev.groups = common_cpu_attr_groups;
error = device_register(&cpu->dev);
if (!error)
per_cpu(cpu_sys_devices, num) = &cpu->dev;
return find_memory_block_hinted(section, NULL);
}
+ static struct attribute *memory_memblk_attrs[] = {
+ &dev_attr_phys_index.attr,
+ &dev_attr_end_phys_index.attr,
+ &dev_attr_state.attr,
+ &dev_attr_phys_device.attr,
+ &dev_attr_removable.attr,
+ NULL
+ };
+
+ static struct attribute_group memory_memblk_attr_group = {
+ .attrs = memory_memblk_attrs,
+ };
+
+ static const struct attribute_group *memory_memblk_attr_groups[] = {
+ &memory_memblk_attr_group,
+ NULL,
+ };
+
+ /*
+ * register_memory - Setup a sysfs device for a memory block
+ */
+ static
+ int register_memory(struct memory_block *memory)
+ {
+ int error;
+
+ memory->dev.bus = &memory_subsys;
+ memory->dev.id = memory->start_section_nr / sections_per_block;
+ memory->dev.release = memory_block_release;
+ memory->dev.groups = memory_memblk_attr_groups;
++ memory->dev.offline = memory->state == MEM_OFFLINE;
+
+ error = device_register(&memory->dev);
+ return error;
+ }
+
static int init_memory_block(struct memory_block **memory,
struct mem_section *section, unsigned long state)
{