Skip to contentSkip to conversation

scsi/atari_scsi: use wait_event()

PATCH Applied Nishanth Aravamudan 1 participant 1 message Jan 21, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 24/39 scsi/atari_scsi: use wait_event()

Hi,

Please consider applying.

Description: Use wait_event() instead of the deprecated sleep_on() function. The second replacement is more difficult, as there are various conditions which may cause the while-loop to break, each resulting in a different effect.

drivers/scsi/atari_scsi.c +14 -17
@@ -67,6 +67,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/wait.h>
 
 #define NDEBUG (0)
 
@@ -559,24 +560,20 @@ static void falcon_get_lock( void )
 
 	local_irq_save(flags);
 
-	while( !in_interrupt() && falcon_got_lock && stdma_others_waiting() )
-		sleep_on( &falcon_fairness_wait );
-
-	while (!falcon_got_lock) {
-		if (in_interrupt())
-			panic( "Falcon SCSI hasn't ST-DMA lock in interrupt" );
-		if (!falcon_trying_lock) {
-			falcon_trying_lock = 1;
-			stdma_lock(scsi_falcon_intr, NULL);
-			falcon_got_lock = 1;
-			falcon_trying_lock = 0;
-			wake_up( &falcon_try_wait );
-		}
-		else {
-			sleep_on( &falcon_try_wait );
-		}
-	}	
+	wait_event(falcon_fairness_wait, (in_interrupt() ||
+			falcon_got_lock || stdma_others_waiting()));
 
+	wait_event(falcon_try_wait, (in_interrupt() ||
+				falcon_got_lock || !falcon_trying_lock));
+	if (in_interrupt())
+		panic( "Falcon SCSI hasn't ST-DMA lock in interrupt" );
+	if (!falcon_trying_lock) {
+		falcon_trying_lock = 1;
+		stdma_lock(scsi_falcon_intr, NULL);
+		falcon_got_lock = 1;
+		falcon_trying_lock = 0;
+		wake_up(&falcon_try_wait);
+	}
 	local_irq_restore(flags);
 	if (!falcon_got_lock)
 		panic("Falcon SCSI: someone stole the lock :-(\n");

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors