From: Stephen Rothwell Date: Wed, 19 Jun 2013 05:26:01 +0000 (+1000) Subject: Merge remote-tracking branch 'driver-core/driver-core-next' X-Git-Tag: next-20130619~26 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=dca61cb218650063300a5ce7c0ba2d35e4943864;p=karo-tx-linux.git Merge remote-tracking branch 'driver-core/driver-core-next' Conflicts: drivers/base/cpu.c drivers/base/firmware_class.c drivers/base/memory.c include/linux/platform_device.h --- dca61cb218650063300a5ce7c0ba2d35e4943864 diff --cc drivers/base/cpu.c index 1d110dc6f0c1,c377673320ed..b9f0eecc8acd --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@@ -102,20 -125,8 +102,19 @@@ static ssize_t cpu_release_store(struc 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 @@@ -151,8 -162,35 +150,25 @@@ static ssize_t show_crash_notes_size(st 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 -#ifdef CONFIG_HOTPLUG_CPU - &hotplug_cpu_attr_group, -#endif - NULL -}; - /* * Print cpu online, possible, present, and system maps */ @@@ -269,6 -305,9 +285,7 @@@ int __cpuinit register_cpu(struct cpu * #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; diff --cc drivers/base/firmware_class.c index 01e21037d8fe,6ede2292f67e..57aa8425d54b --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@@ -446,22 -452,11 +452,18 @@@ static struct firmware_priv *to_firmwar 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) \ diff --cc drivers/base/memory.c index 4ebf97f99fae,e315051cfeeb..2b7813ec6d02 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@@ -595,6 -493,41 +541,42 @@@ struct memory_block *find_memory_block( 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) { diff --cc include/linux/platform_device.h index 3413897474e1,cd46ee58b9dc..ce8e4ffd78c7 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@@ -180,10 -180,13 +180,16 @@@ struct platform_driver const struct platform_device_id *id_table; }; +#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \ + driver)) + - extern int platform_driver_register(struct platform_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