[PATCH] sem2mutex: misc static one-file mutexes
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Dave Jones <davej@codemonkey.org.uk> Cc: Paul Mackerras <paulus@samba.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Jens Axboe <axboe@suse.de> Cc: Neil Brown <neilb@cse.unsw.edu.au> Acked-by: Alasdair G Kergon <agk@redhat.com> Cc: Greg KH <greg@kroah.com> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Adam Belay <ambx1@neo.rr.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
353ab6e97b
commit
14cc3e2b63
@@ -34,7 +34,7 @@
|
||||
#include <asm/system.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <asm/semaphore.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#include "ptrace.h"
|
||||
|
||||
@@ -207,19 +207,19 @@ void die_if_kernel(const char *str, struct pt_regs *regs, int err)
|
||||
die(str, regs, err);
|
||||
}
|
||||
|
||||
static DECLARE_MUTEX(undef_sem);
|
||||
static DEFINE_MUTEX(undef_mutex);
|
||||
static int (*undef_hook)(struct pt_regs *);
|
||||
|
||||
int request_undef_hook(int (*fn)(struct pt_regs *))
|
||||
{
|
||||
int ret = -EBUSY;
|
||||
|
||||
down(&undef_sem);
|
||||
mutex_lock(&undef_mutex);
|
||||
if (undef_hook == NULL) {
|
||||
undef_hook = fn;
|
||||
ret = 0;
|
||||
}
|
||||
up(&undef_sem);
|
||||
mutex_unlock(&undef_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -228,12 +228,12 @@ int release_undef_hook(int (*fn)(struct pt_regs *))
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
down(&undef_sem);
|
||||
mutex_lock(&undef_mutex);
|
||||
if (undef_hook == fn) {
|
||||
undef_hook = NULL;
|
||||
ret = 0;
|
||||
}
|
||||
up(&undef_sem);
|
||||
mutex_unlock(&undef_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user