diff options
author | Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> | 2012-12-11 19:00:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-11 20:22:22 -0500 |
commit | fa7194eb99b8e9fefe96f045002648ffb55f53c0 (patch) | |
tree | d75fdad6d29a53767aad6446c7fc2b3a44a9dd83 /drivers/base | |
parent | b3092b3b734f146d96ca023a75cacf78078f96d5 (diff) |
memory hotplug: suppress "Device memoryX does not have a release() function" warning
When calling remove_memory_block(), the function shows following message
at device_release().
"Device 'memory528' does not have a release() function, it is broken and
must be fixed."
The reason is memory_block's device struct does not have a release()
function.
So the patch registers memory_block_release() to the device's release()
function for suppressing the warning message. Additionally, the patch
moves kfree(mem) into the release function since the release function is
prepared as a means to free a memory_block struct.
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Jiang Liu <liuj97@gmail.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/memory.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 86c88216a503..7eb1211ab688 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -70,6 +70,13 @@ void unregister_memory_isolate_notifier(struct notifier_block *nb) | |||
70 | } | 70 | } |
71 | EXPORT_SYMBOL(unregister_memory_isolate_notifier); | 71 | EXPORT_SYMBOL(unregister_memory_isolate_notifier); |
72 | 72 | ||
73 | static void memory_block_release(struct device *dev) | ||
74 | { | ||
75 | struct memory_block *mem = container_of(dev, struct memory_block, dev); | ||
76 | |||
77 | kfree(mem); | ||
78 | } | ||
79 | |||
73 | /* | 80 | /* |
74 | * register_memory - Setup a sysfs device for a memory block | 81 | * register_memory - Setup a sysfs device for a memory block |
75 | */ | 82 | */ |
@@ -80,6 +87,7 @@ int register_memory(struct memory_block *memory) | |||
80 | 87 | ||
81 | memory->dev.bus = &memory_subsys; | 88 | memory->dev.bus = &memory_subsys; |
82 | memory->dev.id = memory->start_section_nr / sections_per_block; | 89 | memory->dev.id = memory->start_section_nr / sections_per_block; |
90 | memory->dev.release = memory_block_release; | ||
83 | 91 | ||
84 | error = device_register(&memory->dev); | 92 | error = device_register(&memory->dev); |
85 | return error; | 93 | return error; |
@@ -635,7 +643,6 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section, | |||
635 | mem_remove_simple_file(mem, phys_device); | 643 | mem_remove_simple_file(mem, phys_device); |
636 | mem_remove_simple_file(mem, removable); | 644 | mem_remove_simple_file(mem, removable); |
637 | unregister_memory(mem); | 645 | unregister_memory(mem); |
638 | kfree(mem); | ||
639 | } else | 646 | } else |
640 | kobject_put(&mem->dev.kobj); | 647 | kobject_put(&mem->dev.kobj); |
641 | 648 | ||