mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-08 22:23:18 +00:00
driver core: memory: semaphore to mutex
Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
610ad5064c
commit
da19cbcf71
@ -20,6 +20,7 @@
|
|||||||
#include <linux/kobject.h>
|
#include <linux/kobject.h>
|
||||||
#include <linux/memory_hotplug.h>
|
#include <linux/memory_hotplug.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
#include <asm/atomic.h>
|
#include <asm/atomic.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
|
|
||||||
@ -205,7 +206,7 @@ static int memory_block_change_state(struct memory_block *mem,
|
|||||||
unsigned long to_state, unsigned long from_state_req)
|
unsigned long to_state, unsigned long from_state_req)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
down(&mem->state_sem);
|
mutex_lock(&mem->state_mutex);
|
||||||
|
|
||||||
if (mem->state != from_state_req) {
|
if (mem->state != from_state_req) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
@ -217,7 +218,7 @@ static int memory_block_change_state(struct memory_block *mem,
|
|||||||
mem->state = to_state;
|
mem->state = to_state;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
up(&mem->state_sem);
|
mutex_unlock(&mem->state_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +342,7 @@ static int add_memory_block(unsigned long node_id, struct mem_section *section,
|
|||||||
|
|
||||||
mem->phys_index = __section_nr(section);
|
mem->phys_index = __section_nr(section);
|
||||||
mem->state = state;
|
mem->state = state;
|
||||||
init_MUTEX(&mem->state_sem);
|
mutex_init(&mem->state_mutex);
|
||||||
mem->phys_device = phys_device;
|
mem->phys_device = phys_device;
|
||||||
|
|
||||||
ret = register_memory(mem, section, NULL);
|
ret = register_memory(mem, section, NULL);
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
#include <linux/sysdev.h>
|
#include <linux/sysdev.h>
|
||||||
#include <linux/node.h>
|
#include <linux/node.h>
|
||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
#include <asm/semaphore.h>
|
|
||||||
|
|
||||||
struct memory_block {
|
struct memory_block {
|
||||||
unsigned long phys_index;
|
unsigned long phys_index;
|
||||||
@ -30,7 +29,7 @@ struct memory_block {
|
|||||||
* created long after the critical areas during
|
* created long after the critical areas during
|
||||||
* initialization.
|
* initialization.
|
||||||
*/
|
*/
|
||||||
struct semaphore state_sem;
|
struct mutex state_mutex;
|
||||||
int phys_device; /* to which fru does this belong? */
|
int phys_device; /* to which fru does this belong? */
|
||||||
void *hw; /* optional pointer to fw/hw data */
|
void *hw; /* optional pointer to fw/hw data */
|
||||||
int (*phys_callback)(struct memory_block *);
|
int (*phys_callback)(struct memory_block *);
|
||||||
|
@ -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().
|
* This doesn't need a lock to do pfn_to_page().
|
||||||
* The section can't be removed here because of the
|
* 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));
|
zone = page_zone(pfn_to_page(pfn));
|
||||||
pgdat_resize_lock(zone->zone_pgdat, &flags);
|
pgdat_resize_lock(zone->zone_pgdat, &flags);
|
||||||
|
Loading…
Reference in New Issue
Block a user