All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] 6/34: block/ataflop: replace sleep_on() with
@ 2005-01-25 22:28 Nishanth Aravamudan
  0 siblings, 0 replies; only message in thread
From: Nishanth Aravamudan @ 2005-01-25 22:28 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1820 bytes --]

Hi,

Please consider applying.

Description: Use wait_event() instead of the deprecated sleep_on(). These
replacements are straight-forward. The middle change is more difficult, as it is
not a conditional sleep. Therefore, I have converted it to directly use a
locally defined wait-queue.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

--- 2.6.11-rc2-kj-v/drivers/block/ataflop.c	2005-01-24 09:34:04.000000000 -0800
+++ 2.6.11-rc2-kj/drivers/block/ataflop.c	2005-01-25 14:27:36.000000000 -0800
@@ -67,6 +67,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/blkdev.h>
+#include <linux/wait.h>
 
 #include <asm/atafd.h>
 #include <asm/atafdreg.h>
@@ -643,6 +644,7 @@ static void fd_error( void )
 
 static int do_format(int drive, int type, struct atari_format_descr *desc)
 {
+	DEFINE_WAIT(wait);
 	unsigned char	*p;
 	int sect, nsect;
 	unsigned long	flags;
@@ -651,7 +653,7 @@ static int do_format(int drive, int type
 		drive, desc->track, desc->head, desc->sect_offset ));
 
 	local_irq_save(flags);
-	while( fdc_busy ) sleep_on( &fdc_wait );
+	wait_event(fdc_wait, !fdc_busy);
 	fdc_busy = 1;
 	stdma_lock(floppy_irq, NULL);
 	atari_turnon_irq( IRQ_MFP_FDC ); /* should be already, just to be sure */
@@ -706,7 +708,9 @@ static int do_format(int drive, int type
 	ReqSide  = desc->head;
 	do_fd_action( drive );
 
-	sleep_on( &format_wait );
+	prepare_to_wait(&format_wait, &wait, TASK_UNINTERRUPTIBLE);
+	schedule();
+	finish_wait(&format_wait, &wait);
 
 	redo_fd_request();
 	return( FormatError ? -EIO : 0 );	
@@ -1477,7 +1481,7 @@ void do_fd_request(request_queue_t * q)
  	unsigned long flags;
 
 	DPRINT(("do_fd_request for pid %d\n",current->pid));
-	while( fdc_busy ) sleep_on( &fdc_wait );
+	wait_event(fdc_wait, !fdc_busy);
 	fdc_busy = 1;
 	stdma_lock(floppy_irq, NULL);
 

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-01-25 22:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-25 22:28 [KJ] [PATCH] 6/34: block/ataflop: replace sleep_on() with Nishanth Aravamudan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.