[Linux-parport] [-mm PATCH 16/32] drivers/block: fix-up schedule_timeout() usage

Nishanth Aravamudan nacc at us.ibm.com
Mon Aug 15 14:17:39 EDT 2005


Description: Use schedule_timeout_{un,}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.

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

---

 drivers/block/cciss.c      |    7 +++----
 drivers/block/paride/pcd.c |    3 +--
 drivers/block/paride/pf.c  |    3 +--
 drivers/block/paride/pg.c  |    3 +--
 drivers/block/paride/pt.c  |    3 +--
 drivers/block/swim3.c      |    9 +++------
 drivers/block/swim_iop.c   |    3 +--
 drivers/block/xd.c         |    6 ++----
 8 files changed, 13 insertions(+), 24 deletions(-)

diff -urpN 2.6.13-rc5-mm1/drivers/block/cciss.c 2.6.13-rc5-mm1-dev/drivers/block/cciss.c
--- 2.6.13-rc5-mm1/drivers/block/cciss.c	2005-08-07 09:57:49.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/block/cciss.c	2005-08-12 13:21:12.000000000 -0700
@@ -1713,10 +1713,9 @@ static unsigned long pollcomplete(int ct
 
 	for (i = 20 * HZ; i > 0; i--) {
 		done = hba[ctlr]->access.command_completed(hba[ctlr]);
-		if (done == FIFO_EMPTY) {
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(1);
-		} else
+		if (done == FIFO_EMPTY)
+			schedule_timeout_uninterruptible(1);
+		else
 			return (done);
 	}
 	/* Invalid address to tell caller we ran out of time */
diff -urpN 2.6.13-rc5-mm1/drivers/block/paride/pcd.c 2.6.13-rc5-mm1-dev/drivers/block/paride/pcd.c
--- 2.6.13-rc5-mm1/drivers/block/paride/pcd.c	2005-08-07 09:57:23.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/block/paride/pcd.c	2005-08-08 14:08:34.000000000 -0700
@@ -516,8 +516,7 @@ static int pcd_tray_move(struct cdrom_de
 
 static void pcd_sleep(int cs)
 {
-	current->state = TASK_INTERRUPTIBLE;
-	schedule_timeout(cs);
+	schedule_timeout_interruptible(cs);
 }
 
 static int pcd_reset(struct pcd_unit *cd)
diff -urpN 2.6.13-rc5-mm1/drivers/block/paride/pf.c 2.6.13-rc5-mm1-dev/drivers/block/paride/pf.c
--- 2.6.13-rc5-mm1/drivers/block/paride/pf.c	2005-08-07 09:57:23.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/block/paride/pf.c	2005-08-08 14:08:41.000000000 -0700
@@ -507,8 +507,7 @@ static void pf_eject(struct pf_unit *pf)
 
 static void pf_sleep(int cs)
 {
-	current->state = TASK_INTERRUPTIBLE;
-	schedule_timeout(cs);
+	schedule_timeout_interruptible(cs);
 }
 
 /* the ATAPI standard actually specifies the contents of all 7 registers
diff -urpN 2.6.13-rc5-mm1/drivers/block/paride/pg.c 2.6.13-rc5-mm1-dev/drivers/block/paride/pg.c
--- 2.6.13-rc5-mm1/drivers/block/paride/pg.c	2005-08-07 09:57:49.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/block/paride/pg.c	2005-08-08 14:08:48.000000000 -0700
@@ -276,8 +276,7 @@ static inline u8 DRIVE(struct pg *dev)
 
 static void pg_sleep(int cs)
 {
-	current->state = TASK_INTERRUPTIBLE;
-	schedule_timeout(cs);
+	schedule_timeout_interruptible(cs);
 }
 
 static int pg_wait(struct pg *dev, int go, int stop, unsigned long tmo, char *msg)
diff -urpN 2.6.13-rc5-mm1/drivers/block/paride/pt.c 2.6.13-rc5-mm1-dev/drivers/block/paride/pt.c
--- 2.6.13-rc5-mm1/drivers/block/paride/pt.c	2005-08-07 09:57:49.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/block/paride/pt.c	2005-08-08 14:08:55.000000000 -0700
@@ -383,8 +383,7 @@ static int pt_atapi(struct pt_unit *tape
 
 static void pt_sleep(int cs)
 {
-	current->state = TASK_INTERRUPTIBLE;
-	schedule_timeout(cs);
+	schedule_timeout_interruptible(cs);
 }
 
 static int pt_poll_dsc(struct pt_unit *tape, int pause, int tmo, char *msg)
diff -urpN 2.6.13-rc5-mm1/drivers/block/swim3.c 2.6.13-rc5-mm1-dev/drivers/block/swim3.c
--- 2.6.13-rc5-mm1/drivers/block/swim3.c	2005-08-07 09:57:49.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/block/swim3.c	2005-08-08 14:11:31.000000000 -0700
@@ -834,8 +834,7 @@ static int fd_eject(struct floppy_state 
 			break;
 		}
 		swim3_select(fs, RELAX);
-		current->state = TASK_INTERRUPTIBLE;
-		schedule_timeout(1);
+		schedule_timeout_interruptible(1);
 		if (swim3_readbit(fs, DISK_IN) == 0)
 			break;
 	}
@@ -906,8 +905,7 @@ static int floppy_open(struct inode *ino
 				break;
 			}
 			swim3_select(fs, RELAX);
-			current->state = TASK_INTERRUPTIBLE;
-			schedule_timeout(1);
+			schedule_timeout_interruptible(1);
 		}
 		if (err == 0 && (swim3_readbit(fs, SEEK_COMPLETE) == 0
 				 || swim3_readbit(fs, DISK_IN) == 0))
@@ -992,8 +990,7 @@ static int floppy_revalidate(struct gend
 		if (signal_pending(current))
 			break;
 		swim3_select(fs, RELAX);
-		current->state = TASK_INTERRUPTIBLE;
-		schedule_timeout(1);
+		schedule_timeout_interruptible(1);
 	}
 	ret = swim3_readbit(fs, SEEK_COMPLETE) == 0
 		|| swim3_readbit(fs, DISK_IN) == 0;
diff -urpN 2.6.13-rc5-mm1/drivers/block/swim_iop.c 2.6.13-rc5-mm1-dev/drivers/block/swim_iop.c
--- 2.6.13-rc5-mm1/drivers/block/swim_iop.c	2005-03-01 23:37:30.000000000 -0800
+++ 2.6.13-rc5-mm1-dev/drivers/block/swim_iop.c	2005-08-08 14:11:39.000000000 -0700
@@ -338,8 +338,7 @@ static int swimiop_eject(struct floppy_s
 			err = -EINTR;
 			break;
 		}
-		current->state = TASK_INTERRUPTIBLE;
-		schedule_timeout(1);
+		schedule_timeout_interruptible(1);
 	}
 	release_drive(fs);
 	return cmd->error;
diff -urpN 2.6.13-rc5-mm1/drivers/block/xd.c 2.6.13-rc5-mm1-dev/drivers/block/xd.c
--- 2.6.13-rc5-mm1/drivers/block/xd.c	2005-08-07 09:57:23.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/block/xd.c	2005-08-08 14:11:54.000000000 -0700
@@ -529,10 +529,8 @@ static inline u_char xd_waitport (u_shor
 	int success;
 
 	xdc_busy = 1;
-	while ((success = ((inb(port) & mask) != flags)) && time_before(jiffies, expiry)) {
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(1);
-	}
+	while ((success = ((inb(port) & mask) != flags)) && time_before(jiffies, expiry))
+		schedule_timeout_uninterruptible(1);
 	xdc_busy = 0;
 	return (success);
 }



More information about the Linux-parport mailing list