summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorSeth Jennings <sjenning@linux.vnet.ibm.com>2013-08-20 12:13:01 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-21 11:48:41 -0700
commit37a7bd6255b415afe197489b5cd1f9568a7ae058 (patch)
tree7eb1afd7069b8e4ce0f83be1d5463d224c2d4fb3 /drivers/base
parentd7f80530ad0a71615f54607128c30d2422bf4c02 (diff)
drivers: base: reduce add_memory_section() for boot-time only
Now that add_memory_section() is only called from boot time, reduce the logic and remove the enum. Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/memory.c41
1 files changed, 14 insertions, 27 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 2e9a68c64679..a9e9c0902cce 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -602,40 +602,29 @@ static int init_memory_block(struct memory_block **memory,
return ret;
}
-static int add_memory_section(int nid, struct mem_section *section,
- struct memory_block **mem_p,
- unsigned long state, enum mem_add_context context)
+static int add_memory_section(struct mem_section *section,
+ struct memory_block **mem_p)
{
struct memory_block *mem = NULL;
int scn_nr = __section_nr(section);
int ret = 0;
- if (context == BOOT) {
- /* same memory block ? */
- if (mem_p && *mem_p)
- if (scn_nr >= (*mem_p)->start_section_nr &&
- scn_nr <= (*mem_p)->end_section_nr) {
- mem = *mem_p;
- get_device(&mem->dev);
- }
- } else
- mem = find_memory_block(section);
+ if (mem_p && *mem_p) {
+ if (scn_nr >= (*mem_p)->start_section_nr &&
+ scn_nr <= (*mem_p)->end_section_nr) {
+ mem = *mem_p;
+ get_device(&mem->dev);
+ }
+ }
if (mem) {
mem->section_count++;
put_device(&mem->dev);
} else {
- ret = init_memory_block(&mem, section, state);
+ ret = init_memory_block(&mem, section, MEM_ONLINE);
/* store memory_block pointer for next loop */
- if (!ret && context == BOOT)
- if (mem_p)
- *mem_p = mem;
- }
-
- if (!ret) {
- if (context == HOTPLUG &&
- mem->section_count == sections_per_block)
- ret = register_mem_sect_under_node(mem, nid);
+ if (!ret && mem_p)
+ *mem_p = mem;
}
return ret;
@@ -764,10 +753,8 @@ int __init memory_dev_init(void)
if (!present_section_nr(i))
continue;
/* don't need to reuse memory_block if only one per block */
- err = add_memory_section(0, __nr_to_section(i),
- (sections_per_block == 1) ? NULL : &mem,
- MEM_ONLINE,
- BOOT);
+ err = add_memory_section(__nr_to_section(i),
+ (sections_per_block == 1) ? NULL : &mem);
if (!ret)
ret = err;
}