Skip to contentSkip to conversation

14/34: cdrom/mcdx: replace interruptible_sleep_on()

PATCH New Nishanth Aravamudan 1 participant 1 message Jan 25, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 14/34: cdrom/mcdx: replace interruptible_sleep_on()

Hi,

Please consider applying.

Description: Use wait_event() instead of interruptible_sleep_on(). First, signals are not dealt with, so *interruptible* seems unnecessary. Second, the xtrace lines will now only be displayed once, instead of once per loop iteration. Patch is compile-tested.

drivers/cdrom/mcdx.c +5 -8
@@ -68,6 +68,7 @@ static const char *mcdx_c_version
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/init.h>
+#include <linux/wait.h>
 #include <asm/io.h>
 #include <asm/current.h>
 #include <asm/uaccess.h>
@@ -910,11 +911,9 @@ static int mcdx_talk(struct s_drive_stuf
 	if ((discard = (buffer == NULL)))
 		buffer = &c;
 
-	while (stuffp->lock) {
-		xtrace(SLEEP, "*** talk: lockq\n");
-		interruptible_sleep_on(&stuffp->lockq);
-		xtrace(SLEEP, "talk: awoken\n");
-	}
+	xtrace(SLEEP, "*** talk: lockq\n");
+	wait_event(stuffp->lockq, !stuffp->lock);
+	xtrace(SLEEP, "talk: awoken\n");
 
 	stuffp->lock = 1;
 
@@ -1341,9 +1340,7 @@ static int mcdx_xfer(struct s_drive_stuf
 		return -1;
 	}
 
-	while (stuffp->lock) {
-		interruptible_sleep_on(&stuffp->lockq);
-	}
+	wait_event(stuffp->lockq, !stuffp->lock);
 
 	if (stuffp->valid && (sector >= stuffp->pending)
 	    && (sector < stuffp->low_border)) {

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