Commit d7f80530 authored by Seth Jennings's avatar Seth Jennings Committed by Greg Kroah-Hartman
Browse files

drivers: base: unshare add_memory_section() from hotplug

add_memory_section() is currently called from both boot time and run
time via hotplug and there is a lot of nastiness to allow for shared
code including an enum parameter to convey the calling context to

This patch is the first step in breaking up the messy code sharing by
pulling the hotplug path for add_memory_section() directly into
Signed-off-by: default avatarSeth Jennings <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent df2b717c
......@@ -647,12 +647,25 @@ static int add_memory_section(int nid, struct mem_section *section,
int register_new_memory(int nid, struct mem_section *section)
int ret;
int ret = 0;
struct memory_block *mem;
ret = add_memory_section(nid, section, NULL, MEM_OFFLINE, HOTPLUG);
mem = find_memory_block(section);
if (mem) {
} else {
ret = init_memory_block(&mem, section, MEM_OFFLINE);
if (ret)
goto out;
if (mem->section_count == sections_per_block)
ret = register_mem_sect_under_node(mem, nid);
return ret;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment