[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>
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c
index b80318f..04d6417 100644
--- a/drivers/oprofile/event_buffer.c
+++ b/drivers/oprofile/event_buffer.c
@@ -24,7 +24,7 @@
 #include "event_buffer.h"
 #include "oprofile_stats.h"
 
-DECLARE_MUTEX(buffer_sem);
+DEFINE_MUTEX(buffer_mutex);
  
 static unsigned long buffer_opened;
 static DECLARE_WAIT_QUEUE_HEAD(buffer_wait);
@@ -32,7 +32,7 @@
 static unsigned long buffer_size;
 static unsigned long buffer_watershed;
 static size_t buffer_pos;
-/* atomic_t because wait_event checks it outside of buffer_sem */
+/* atomic_t because wait_event checks it outside of buffer_mutex */
 static atomic_t buffer_ready = ATOMIC_INIT(0);
 
 /* Add an entry to the event buffer. When we
@@ -60,10 +60,10 @@
  */
 void wake_up_buffer_waiter(void)
 {
-	down(&buffer_sem);
+	mutex_lock(&buffer_mutex);
 	atomic_set(&buffer_ready, 1);
 	wake_up(&buffer_wait);
-	up(&buffer_sem);
+	mutex_unlock(&buffer_mutex);
 }
 
  
@@ -162,7 +162,7 @@
 	if (!atomic_read(&buffer_ready))
 		return -EAGAIN;
 
-	down(&buffer_sem);
+	mutex_lock(&buffer_mutex);
 
 	atomic_set(&buffer_ready, 0);
 
@@ -177,7 +177,7 @@
 	buffer_pos = 0;
  
 out:
-	up(&buffer_sem);
+	mutex_unlock(&buffer_mutex);
 	return retval;
 }