From: Nishanth Aravamudan <[email-masked]>

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

(akpm: this patch relies on other stuff in -mm, please don't apply)

Signed-off-by: Nishanth Aravamudan <[email-masked]>
Cc: Jens Axboe <[email-masked]>
Signed-off-by: Andrew Morton <[email-masked]>
---

 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 -puN drivers/block/cciss.c~drivers-block-fix-up-schedule_timeout-usage drivers/block/cciss.c
--- 25/drivers/block/cciss.c~drivers-block-fix-up-schedule_timeout-usage	Wed Aug 17 17:00:42 2005
+++ 25-akpm/drivers/block/cciss.c	Wed Aug 17 17:00:42 2005
@@ -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 -puN drivers/block/paride/pcd.c~drivers-block-fix-up-schedule_timeout-usage drivers/block/paride/pcd.c
--- 25/drivers/block/paride/pcd.c~drivers-block-fix-up-schedule_timeout-usage	Wed Aug 17 17:00:42 2005
+++ 25-akpm/drivers/block/paride/pcd.c	Wed Aug 17 17:00:42 2005
@@ -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 -puN drivers/block/paride/pf.c~drivers-block-fix-up-schedule_timeout-usage drivers/block/paride/pf.c
--- 25/drivers/block/paride/pf.c~drivers-block-fix-up-schedule_timeout-usage	Wed Aug 17 17:00:42 2005
+++ 25-akpm/drivers/block/paride/pf.c	Wed Aug 17 17:00:42 2005
@@ -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 -puN drivers/block/paride/pg.c~drivers-block-fix-up-schedule_timeout-usage drivers/block/paride/pg.c
--- 25/drivers/block/paride/pg.c~drivers-block-fix-up-schedule_timeout-usage	Wed Aug 17 17:00:42 2005
+++ 25-akpm/drivers/block/paride/pg.c	Wed Aug 17 17:00:42 2005
@@ -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 -puN drivers/block/paride/pt.c~drivers-block-fix-up-schedule_timeout-usage drivers/block/paride/pt.c
--- 25/drivers/block/paride/pt.c~drivers-block-fix-up-schedule_timeout-usage	Wed Aug 17 17:00:42 2005
+++ 25-akpm/drivers/block/paride/pt.c	Wed Aug 17 17:00:42 2005
@@ -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 -puN drivers/block/swim3.c~drivers-block-fix-up-schedule_timeout-usage drivers/block/swim3.c
--- 25/drivers/block/swim3.c~drivers-block-fix-up-schedule_timeout-usage	Wed Aug 17 17:00:42 2005
+++ 25-akpm/drivers/block/swim3.c	Wed Aug 17 17:00:42 2005
@@ -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 -puN drivers/block/swim_iop.c~drivers-block-fix-up-schedule_timeout-usage drivers/block/swim_iop.c
--- 25/drivers/block/swim_iop.c~drivers-block-fix-up-schedule_timeout-usage	Wed Aug 17 17:00:42 2005
+++ 25-akpm/drivers/block/swim_iop.c	Wed Aug 17 17:00:42 2005
@@ -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 -puN drivers/block/xd.c~drivers-block-fix-up-schedule_timeout-usage drivers/block/xd.c
--- 25/drivers/block/xd.c~drivers-block-fix-up-schedule_timeout-usage	Wed Aug 17 17:00:42 2005
+++ 25-akpm/drivers/block/xd.c	Wed Aug 17 17:00:42 2005
@@ -530,10 +530,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);
 }
_