diff options
author | Markus Armbruster <armbru@redhat.com> | 2006-06-25 05:47:33 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 10:01:04 -0700 |
commit | 59cc185ada89245204c658ebcf64422968736672 (patch) | |
tree | 042e46cfe90c2ad5b711e2791b05f73ab1fe7725 /drivers/oprofile/oprof.c | |
parent | a2926b1449bcc3d348e2228114b04869dc2f3986 (diff) | |
download | blackbird-op-linux-59cc185ada89245204c658ebcf64422968736672.tar.gz blackbird-op-linux-59cc185ada89245204c658ebcf64422968736672.zip |
[PATCH] oprofile: convert from semaphores to mutexes
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Cc: Philippe Elie <phil.el@wanadoo.fr>
Cc: John Levon <levon@movementarian.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/oprofile/oprof.c')
-rw-r--r-- | drivers/oprofile/oprof.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c index b3f1cd6a24c1..e5162a64018b 100644 --- a/drivers/oprofile/oprof.c +++ b/drivers/oprofile/oprof.c @@ -12,7 +12,7 @@ #include <linux/init.h> #include <linux/oprofile.h> #include <linux/moduleparam.h> -#include <asm/semaphore.h> +#include <asm/mutex.h> #include "oprof.h" #include "event_buffer.h" @@ -25,7 +25,7 @@ struct oprofile_operations oprofile_ops; unsigned long oprofile_started; unsigned long backtrace_depth; static unsigned long is_setup; -static DECLARE_MUTEX(start_sem); +static DEFINE_MUTEX(start_mutex); /* timer 0 - use performance monitoring hardware if available @@ -37,7 +37,7 @@ int oprofile_setup(void) { int err; - down(&start_sem); + mutex_lock(&start_mutex); if ((err = alloc_cpu_buffers())) goto out; @@ -57,7 +57,7 @@ int oprofile_setup(void) goto out3; is_setup = 1; - up(&start_sem); + mutex_unlock(&start_mutex); return 0; out3: @@ -68,7 +68,7 @@ out2: out1: free_cpu_buffers(); out: - up(&start_sem); + mutex_unlock(&start_mutex); return err; } @@ -78,7 +78,7 @@ int oprofile_start(void) { int err = -EINVAL; - down(&start_sem); + mutex_lock(&start_mutex); if (!is_setup) goto out; @@ -95,7 +95,7 @@ int oprofile_start(void) oprofile_started = 1; out: - up(&start_sem); + mutex_unlock(&start_mutex); return err; } @@ -103,7 +103,7 @@ out: /* echo 0>/dev/oprofile/enable */ void oprofile_stop(void) { - down(&start_sem); + mutex_lock(&start_mutex); if (!oprofile_started) goto out; oprofile_ops.stop(); @@ -111,20 +111,20 @@ void oprofile_stop(void) /* wake up the daemon to read what remains */ wake_up_buffer_waiter(); out: - up(&start_sem); + mutex_unlock(&start_mutex); } void oprofile_shutdown(void) { - down(&start_sem); + mutex_lock(&start_mutex); sync_stop(); if (oprofile_ops.shutdown) oprofile_ops.shutdown(); is_setup = 0; free_event_buffer(); free_cpu_buffers(); - up(&start_sem); + mutex_unlock(&start_mutex); } @@ -132,7 +132,7 @@ int oprofile_set_backtrace(unsigned long val) { int err = 0; - down(&start_sem); + mutex_lock(&start_mutex); if (oprofile_started) { err = -EBUSY; @@ -147,7 +147,7 @@ int oprofile_set_backtrace(unsigned long val) backtrace_depth = val; out: - up(&start_sem); + mutex_unlock(&start_mutex); return err; } |