aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/event_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oprofile/event_buffer.c')
-rw-r--r--drivers/oprofile/event_buffer.c12
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
27DECLARE_MUTEX(buffer_sem); 27DEFINE_MUTEX(buffer_mutex);
28 28
29static unsigned long buffer_opened; 29static unsigned long buffer_opened;
30static DECLARE_WAIT_QUEUE_HEAD(buffer_wait); 30static DECLARE_WAIT_QUEUE_HEAD(buffer_wait);
@@ -32,7 +32,7 @@ static unsigned long * event_buffer;
32static unsigned long buffer_size; 32static unsigned long buffer_size;
33static unsigned long buffer_watershed; 33static unsigned long buffer_watershed;
34static size_t buffer_pos; 34static 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 */
36static atomic_t buffer_ready = ATOMIC_INIT(0); 36static 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 */
61void wake_up_buffer_waiter(void) 61void 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
179out: 179out:
180 up(&buffer_sem); 180 mutex_unlock(&buffer_mutex);
181 return retval; 181 return retval;
182} 182}
183 183