Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213474
b: refs/heads/master
c: e4619c8
h: refs/heads/master
v: v3
  • Loading branch information
Nathan Fontenot authored and Greg Kroah-Hartman committed Oct 22, 2010
1 parent 2931a40 commit 7fc39b0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1ce873abed551a4a0f35e25af9eeec4efdcf341b
refs/heads/master: e4619c857d1d769b1172a75ba6b6ebd1186a9c58
66 changes: 33 additions & 33 deletions trunk/drivers/base/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,39 +435,6 @@ int __weak arch_get_memory_phys_device(unsigned long start_pfn)
return 0;
}

static int add_memory_block(int nid, struct mem_section *section,
unsigned long state, enum mem_add_context context)
{
struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL);
unsigned long start_pfn;
int ret = 0;

if (!mem)
return -ENOMEM;

mem->phys_index = __section_nr(section);
mem->state = state;
mutex_init(&mem->state_mutex);
start_pfn = section_nr_to_pfn(mem->phys_index);
mem->phys_device = arch_get_memory_phys_device(start_pfn);

ret = register_memory(mem, section);
if (!ret)
ret = mem_create_simple_file(mem, phys_index);
if (!ret)
ret = mem_create_simple_file(mem, state);
if (!ret)
ret = mem_create_simple_file(mem, phys_device);
if (!ret)
ret = mem_create_simple_file(mem, removable);
if (!ret) {
if (context == HOTPLUG)
ret = register_mem_sect_under_node(mem, nid);
}

return ret;
}

struct memory_block *find_memory_block_hinted(struct mem_section *section,
struct memory_block *hint)
{
Expand Down Expand Up @@ -507,6 +474,39 @@ struct memory_block *find_memory_block(struct mem_section *section)
return find_memory_block_hinted(section, NULL);
}

static int add_memory_block(int nid, struct mem_section *section,
unsigned long state, enum mem_add_context context)
{
struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL);
unsigned long start_pfn;
int ret = 0;

if (!mem)
return -ENOMEM;

mem->phys_index = __section_nr(section);
mem->state = state;
mutex_init(&mem->state_mutex);
start_pfn = section_nr_to_pfn(mem->phys_index);
mem->phys_device = arch_get_memory_phys_device(start_pfn);

ret = register_memory(mem, section);
if (!ret)
ret = mem_create_simple_file(mem, phys_index);
if (!ret)
ret = mem_create_simple_file(mem, state);
if (!ret)
ret = mem_create_simple_file(mem, phys_device);
if (!ret)
ret = mem_create_simple_file(mem, removable);
if (!ret) {
if (context == HOTPLUG)
ret = register_mem_sect_under_node(mem, nid);
}

return ret;
}

int remove_memory_block(unsigned long node_id, struct mem_section *section,
int phys_device)
{
Expand Down

0 comments on commit 7fc39b0

Please sign in to comment.