Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213475
b: refs/heads/master
c: 2938ffb
h: refs/heads/master
i:
  213473: 2931a40
  213471: 2cc1d4d
v: v3
  • Loading branch information
Nathan Fontenot authored and Greg Kroah-Hartman committed Oct 22, 2010
1 parent 7fc39b0 commit 5e1ac3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e4619c857d1d769b1172a75ba6b6ebd1186a9c58
refs/heads/master: 2938ffbd466d2811a6012609684a2298eef35065
7 changes: 7 additions & 0 deletions trunk/drivers/base/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <asm/atomic.h>
#include <asm/uaccess.h>

static DEFINE_MUTEX(mem_sysfs_mutex);

#define MEMORY_CLASS_NAME "memory"

static struct sysdev_class memory_sysdev_class = {
Expand Down Expand Up @@ -484,6 +486,8 @@ static int add_memory_block(int nid, struct mem_section *section,
if (!mem)
return -ENOMEM;

mutex_lock(&mem_sysfs_mutex);

mem->phys_index = __section_nr(section);
mem->state = state;
mutex_init(&mem->state_mutex);
Expand All @@ -504,6 +508,7 @@ static int add_memory_block(int nid, struct mem_section *section,
ret = register_mem_sect_under_node(mem, nid);
}

mutex_unlock(&mem_sysfs_mutex);
return ret;
}

Expand All @@ -512,6 +517,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section,
{
struct memory_block *mem;

mutex_lock(&mem_sysfs_mutex);
mem = find_memory_block(section);
unregister_mem_sect_under_nodes(mem);
mem_remove_simple_file(mem, phys_index);
Expand All @@ -520,6 +526,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section,
mem_remove_simple_file(mem, removable);
unregister_memory(mem, section);

mutex_unlock(&mem_sysfs_mutex);
return 0;
}

Expand Down

0 comments on commit 5e1ac3f

Please sign in to comment.