aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/memory.c')
-rw-r--r--drivers/base/memory.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 7ae413fdd5fc..1f3801a8184d 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -20,6 +20,7 @@
20#include <linux/kobject.h> 20#include <linux/kobject.h>
21#include <linux/memory_hotplug.h> 21#include <linux/memory_hotplug.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/mutex.h>
23#include <asm/atomic.h> 24#include <asm/atomic.h>
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25 26
@@ -205,7 +206,7 @@ static int memory_block_change_state(struct memory_block *mem,
205 unsigned long to_state, unsigned long from_state_req) 206 unsigned long to_state, unsigned long from_state_req)
206{ 207{
207 int ret = 0; 208 int ret = 0;
208 down(&mem->state_sem); 209 mutex_lock(&mem->state_mutex);
209 210
210 if (mem->state != from_state_req) { 211 if (mem->state != from_state_req) {
211 ret = -EINVAL; 212 ret = -EINVAL;
@@ -217,7 +218,7 @@ static int memory_block_change_state(struct memory_block *mem,
217 mem->state = to_state; 218 mem->state = to_state;
218 219
219out: 220out:
220 up(&mem->state_sem); 221 mutex_unlock(&mem->state_mutex);
221 return ret; 222 return ret;
222} 223}
223 224
@@ -341,7 +342,7 @@ static int add_memory_block(unsigned long node_id, struct mem_section *section,
341 342
342 mem->phys_index = __section_nr(section); 343 mem->phys_index = __section_nr(section);
343 mem->state = state; 344 mem->state = state;
344 init_MUTEX(&mem->state_sem); 345 mutex_init(&mem->state_mutex);
345 mem->phys_device = phys_device; 346 mem->phys_device = phys_device;
346 347
347 ret = register_memory(mem, section, NULL); 348 ret = register_memory(mem, section, NULL);