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 container_of(dev, struct firmware_priv, dev);
}
- static void fw_load_abort(struct firmware_priv *fw_priv)
+ static void fw_load_abort(struct firmware_buf *buf)
{
- struct firmware_buf *buf = fw_priv->buf;
-
+ /*
+ * There is a small window in which user can write to 'loading'
+ * between loading done and disappearance of 'loading'
+ */
+ if (test_bit(FW_STATUS_DONE, &buf->status))
+ return;
+
+ list_del_init(&buf->pending_list);
set_bit(FW_STATUS_ABORT, &buf->status);
complete_all(&buf->completion);
-
- /* avoid user action after loading abort */
- fw_priv->buf = NULL;
}
#define is_fw_load_aborted(buf) \
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)
{
const struct platform_device_id *id_table;
};
- extern int platform_driver_register(struct platform_driver *);
+#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
+ driver))
+
+ /*
+ * use a macro to avoid include chaining to get THIS_MODULE
+ */
+ #define platform_driver_register(drv) \
+ __platform_driver_register(drv, THIS_MODULE)
+ extern int __platform_driver_register(struct platform_driver *,
+ struct module *);
extern void platform_driver_unregister(struct platform_driver *);
/* non-hotpluggable platform devices may use this so that probe() and