From: Daniel Walker <dwalker@mvista.com>
To: akpm@linux-foundation.org
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org, linux@bohmer.net,
jonathan@jonmasters.org, matthias.kaehlcke@gmail.com,
kjwinchester@gmail.com
Subject: [PATCH 2/2] [RESEND] driver base: memory: semaphore to mutex
Date: Sun, 16 Dec 2007 00:00:02 -0800 [thread overview]
Message-ID: <20071216181740.985565217@mvista.com> (raw)
In-Reply-To: <20071216181705.714358296@mvista.com>
[-- Attachment #1: base-memory-semaphore-to-mutex.patch --]
[-- Type: text/plain, Size: 2539 bytes --]
Signed-off-by: Daniel Walker <dwalker@mvista.com>
---
drivers/base/memory.c | 7 ++++---
include/linux/memory.h | 5 ++---
mm/memory_hotplug.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
Index: linux-2.6.23/drivers/base/memory.c
===================================================================
--- linux-2.6.23.orig/drivers/base/memory.c
+++ linux-2.6.23/drivers/base/memory.c
@@ -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>
@@ -220,7 +221,7 @@ static int memory_block_change_state(str
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;
@@ -232,7 +233,7 @@ static int memory_block_change_state(str
mem->state = to_state;
out:
- up(&mem->state_sem);
+ mutex_unlock(&mem->state_mutex);
return ret;
}
@@ -357,7 +358,7 @@ static int add_memory_block(unsigned lon
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);
Index: linux-2.6.23/include/linux/memory.h
===================================================================
--- linux-2.6.23.orig/include/linux/memory.h
+++ linux-2.6.23/include/linux/memory.h
@@ -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;
@@ -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 *);
Index: linux-2.6.23/mm/memory_hotplug.c
===================================================================
--- linux-2.6.23.orig/mm/memory_hotplug.c
+++ linux-2.6.23/mm/memory_hotplug.c
@@ -209,7 +209,7 @@ int online_pages(unsigned long pfn, unsi
/*
* 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);
--
prev parent reply other threads:[~2007-12-16 18:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071216181705.714358296@mvista.com>
2007-12-16 8:00 ` [PATCH 1/2] [RESEND] ps3: vuart: fix error path locking Daniel Walker
2007-12-16 8:00 ` Daniel Walker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071216181740.985565217@mvista.com \
--to=dwalker@mvista.com \
--cc=akpm@linux-foundation.org \
--cc=jonathan@jonmasters.org \
--cc=kjwinchester@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@bohmer.net \
--cc=matthias.kaehlcke@gmail.com \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®