patch-2.4.6 linux/drivers/media/video/planb.c

Next file: linux/drivers/media/video/planb.h
Previous file: linux/drivers/media/video/i2c-parport.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.5/linux/drivers/media/video/planb.c linux/drivers/media/video/planb.c
@@ -50,6 +50,7 @@
 #include <asm/pgtable.h>
 #include <asm/page.h>
 #include <asm/irq.h>
+#include <asm/semaphore.h>
 
 #include "planb.h"
 #include "saa7196.h"
@@ -326,41 +327,14 @@
 /* misc. supporting functions */
 /******************************/
 
-static void __planb_wait(struct planb *pb)
-{
-	DECLARE_WAITQUEUE(wait, current);
-
-	add_wait_queue(&pb->lockq, &wait);
-repeat:
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	if (pb->lock) {
-		schedule();
-		goto repeat;
-	}
-	remove_wait_queue(&pb->lockq, &wait);
-	current->state = TASK_RUNNING;
-}
-
-static inline void planb_wait(struct planb *pb)
-{
-	DEBUG("PlanB: planb_wait\n");
-	if(pb->lock)
-		__planb_wait(pb);
-}
-
 static inline void planb_lock(struct planb *pb)
 {
-	DEBUG("PlanB: planb_lock\n");
-	if(pb->lock)
-		__planb_wait(pb);
-	pb->lock = 1;
+	down(&pb->lock);
 }
 
 static inline void planb_unlock(struct planb *pb)
 {
-	DEBUG("PlanB: planb_unlock\n");
-	pb->lock = 0;
-	wake_up(&pb->lockq);
+	up(&pb->lock);
 }
 
 /***************/
@@ -2098,7 +2072,7 @@
 	pb->tab_size = PLANB_MAXLINES + 40;
 	pb->suspend = 0;
 	pb->lock = 0;
-	init_waitqueue_head(&pb->lockq);
+	init_MUTEX(&pb->lock);
 	pb->ch1_cmd = 0;
 	pb->ch2_cmd = 0;
 	pb->mask = 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)