Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91386
b: refs/heads/master
c: da19cbc
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Walker authored and Greg Kroah-Hartman committed Apr 20, 2008
1 parent 0067f9e commit d02e0f0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 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: 610ad5064cb90aec35f5837bbde3d316fe02aca7
refs/heads/master: da19cbcf71cde3c09587b5924d113f0c7f1fd23a
7 changes: 4 additions & 3 deletions trunk/drivers/base/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/kobject.h>
#include <linux/memory_hotplug.h>
#include <linux/mm.h>
#include <linux/mutex.h>
#include <asm/atomic.h>
#include <asm/uaccess.h>

Expand Down Expand Up @@ -205,7 +206,7 @@ static int memory_block_change_state(struct memory_block *mem,
unsigned long to_state, unsigned long from_state_req)
{
int ret = 0;
down(&mem->state_sem);
mutex_lock(&mem->state_mutex);

if (mem->state != from_state_req) {
ret = -EINVAL;
Expand All @@ -217,7 +218,7 @@ static int memory_block_change_state(struct memory_block *mem,
mem->state = to_state;

out:
up(&mem->state_sem);
mutex_unlock(&mem->state_mutex);
return ret;
}

Expand Down Expand Up @@ -341,7 +342,7 @@ static int add_memory_block(unsigned long node_id, struct mem_section *section,

mem->phys_index = __section_nr(section);
mem->state = state;
init_MUTEX(&mem->state_sem);
mutex_init(&mem->state_mutex);
mem->phys_device = phys_device;

ret = register_memory(mem, section, NULL);
Expand Down
5 changes: 2 additions & 3 deletions trunk/include/linux/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include <linux/sysdev.h>
#include <linux/node.h>
#include <linux/compiler.h>

#include <asm/semaphore.h>
#include <linux/mutex.h>

struct memory_block {
unsigned long phys_index;
Expand All @@ -30,7 +29,7 @@ struct memory_block {
* created long after the critical areas during
* initialization.
*/
struct semaphore state_sem;
struct mutex state_mutex;
int phys_device; /* to which fru does this belong? */
void *hw; /* optional pointer to fw/hw data */
int (*phys_callback)(struct memory_block *);
Expand Down
2 changes: 1 addition & 1 deletion trunk/mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
/*
* This doesn't need a lock to do pfn_to_page().
* The section can't be removed here because of the
* memory_block->state_sem.
* memory_block->state_mutex.
*/
zone = page_zone(pfn_to_page(pfn));
pgdat_resize_lock(zone->zone_pgdat, &flags);
Expand Down

0 comments on commit d02e0f0

Please sign in to comment.