diff options
author | Markus Armbruster <armbru@redhat.com> | 2006-06-25 08:47:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:04 -0400 |
commit | 59cc185ada89245204c658ebcf64422968736672 (patch) | |
tree | 042e46cfe90c2ad5b711e2791b05f73ab1fe7725 /drivers/oprofile/event_buffer.c | |
parent | a2926b1449bcc3d348e2228114b04869dc2f3986 (diff) |
[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/event_buffer.c')
-rw-r--r-- | drivers/oprofile/event_buffer.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index b80318f03420..04d641714d34 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "event_buffer.h" | 24 | #include "event_buffer.h" |
25 | #include "oprofile_stats.h" | 25 | #include "oprofile_stats.h" |
26 | 26 | ||
27 | DECLARE_MUTEX(buffer_sem); | 27 | DEFINE_MUTEX(buffer_mutex); |
28 | 28 | ||
29 | static unsigned long buffer_opened; | 29 | static unsigned long buffer_opened; |
30 | static DECLARE_WAIT_QUEUE_HEAD(buffer_wait); | 30 | static DECLARE_WAIT_QUEUE_HEAD(buffer_wait); |
@@ -32,7 +32,7 @@ static unsigned long * event_buffer; | |||
32 | static unsigned long buffer_size; | 32 | static unsigned long buffer_size; |
33 | static unsigned long buffer_watershed; | 33 | static unsigned long buffer_watershed; |
34 | static size_t buffer_pos; | 34 | static size_t buffer_pos; |
35 | /* atomic_t because wait_event checks it outside of buffer_sem */ | 35 | /* atomic_t because wait_event checks it outside of buffer_mutex */ |
36 | static atomic_t buffer_ready = ATOMIC_INIT(0); | 36 | static atomic_t buffer_ready = ATOMIC_INIT(0); |
37 | 37 | ||
38 | /* Add an entry to the event buffer. When we | 38 | /* Add an entry to the event buffer. When we |
@@ -60,10 +60,10 @@ void add_event_entry(unsigned long value) | |||
60 | */ | 60 | */ |
61 | void wake_up_buffer_waiter(void) | 61 | void wake_up_buffer_waiter(void) |
62 | { | 62 | { |
63 | down(&buffer_sem); | 63 | mutex_lock(&buffer_mutex); |
64 | atomic_set(&buffer_ready, 1); | 64 | atomic_set(&buffer_ready, 1); |
65 | wake_up(&buffer_wait); | 65 | wake_up(&buffer_wait); |
66 | up(&buffer_sem); | 66 | mutex_unlock(&buffer_mutex); |
67 | } | 67 | } |
68 | 68 | ||
69 | 69 | ||
@@ -162,7 +162,7 @@ static ssize_t event_buffer_read(struct file * file, char __user * buf, | |||
162 | if (!atomic_read(&buffer_ready)) | 162 | if (!atomic_read(&buffer_ready)) |
163 | return -EAGAIN; | 163 | return -EAGAIN; |
164 | 164 | ||
165 | down(&buffer_sem); | 165 | mutex_lock(&buffer_mutex); |
166 | 166 | ||
167 | atomic_set(&buffer_ready, 0); | 167 | atomic_set(&buffer_ready, 0); |
168 | 168 | ||
@@ -177,7 +177,7 @@ static ssize_t event_buffer_read(struct file * file, char __user * buf, | |||
177 | buffer_pos = 0; | 177 | buffer_pos = 0; |
178 | 178 | ||
179 | out: | 179 | out: |
180 | up(&buffer_sem); | 180 | mutex_unlock(&buffer_mutex); |
181 | return retval; | 181 | return retval; |
182 | } | 182 | } |
183 | 183 | ||