Commit 86e84862 authored by Nishanth Aravamudan's avatar Nishanth Aravamudan Committed by Linus Torvalds

[PATCH] drivers/block: fix-up schedule_timeout() usage

Use schedule_timeout_{un,}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.
Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 310b587e
...@@ -1713,10 +1713,9 @@ static unsigned long pollcomplete(int ctlr) ...@@ -1713,10 +1713,9 @@ static unsigned long pollcomplete(int ctlr)
for (i = 20 * HZ; i > 0; i--) { for (i = 20 * HZ; i > 0; i--) {
done = hba[ctlr]->access.command_completed(hba[ctlr]); done = hba[ctlr]->access.command_completed(hba[ctlr]);
if (done == FIFO_EMPTY) { if (done == FIFO_EMPTY)
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1); else
} else
return (done); return (done);
} }
/* Invalid address to tell caller we ran out of time */ /* Invalid address to tell caller we ran out of time */
......
...@@ -516,8 +516,7 @@ static int pcd_tray_move(struct cdrom_device_info *cdi, int position) ...@@ -516,8 +516,7 @@ static int pcd_tray_move(struct cdrom_device_info *cdi, int position)
static void pcd_sleep(int cs) static void pcd_sleep(int cs)
{ {
current->state = TASK_INTERRUPTIBLE; schedule_timeout_interruptible(cs);
schedule_timeout(cs);
} }
static int pcd_reset(struct pcd_unit *cd) static int pcd_reset(struct pcd_unit *cd)
......
...@@ -507,8 +507,7 @@ static void pf_eject(struct pf_unit *pf) ...@@ -507,8 +507,7 @@ static void pf_eject(struct pf_unit *pf)
static void pf_sleep(int cs) static void pf_sleep(int cs)
{ {
current->state = TASK_INTERRUPTIBLE; schedule_timeout_interruptible(cs);
schedule_timeout(cs);
} }
/* the ATAPI standard actually specifies the contents of all 7 registers /* the ATAPI standard actually specifies the contents of all 7 registers
......
...@@ -276,8 +276,7 @@ static inline u8 DRIVE(struct pg *dev) ...@@ -276,8 +276,7 @@ static inline u8 DRIVE(struct pg *dev)
static void pg_sleep(int cs) static void pg_sleep(int cs)
{ {
current->state = TASK_INTERRUPTIBLE; schedule_timeout_interruptible(cs);
schedule_timeout(cs);
} }
static int pg_wait(struct pg *dev, int go, int stop, unsigned long tmo, char *msg) static int pg_wait(struct pg *dev, int go, int stop, unsigned long tmo, char *msg)
......
...@@ -383,8 +383,7 @@ static int pt_atapi(struct pt_unit *tape, char *cmd, int dlen, char *buf, char * ...@@ -383,8 +383,7 @@ static int pt_atapi(struct pt_unit *tape, char *cmd, int dlen, char *buf, char *
static void pt_sleep(int cs) static void pt_sleep(int cs)
{ {
current->state = TASK_INTERRUPTIBLE; schedule_timeout_interruptible(cs);
schedule_timeout(cs);
} }
static int pt_poll_dsc(struct pt_unit *tape, int pause, int tmo, char *msg) static int pt_poll_dsc(struct pt_unit *tape, int pause, int tmo, char *msg)
......
...@@ -834,8 +834,7 @@ static int fd_eject(struct floppy_state *fs) ...@@ -834,8 +834,7 @@ static int fd_eject(struct floppy_state *fs)
break; break;
} }
swim3_select(fs, RELAX); swim3_select(fs, RELAX);
current->state = TASK_INTERRUPTIBLE; schedule_timeout_interruptible(1);
schedule_timeout(1);
if (swim3_readbit(fs, DISK_IN) == 0) if (swim3_readbit(fs, DISK_IN) == 0)
break; break;
} }
...@@ -906,8 +905,7 @@ static int floppy_open(struct inode *inode, struct file *filp) ...@@ -906,8 +905,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
break; break;
} }
swim3_select(fs, RELAX); swim3_select(fs, RELAX);
current->state = TASK_INTERRUPTIBLE; schedule_timeout_interruptible(1);
schedule_timeout(1);
} }
if (err == 0 && (swim3_readbit(fs, SEEK_COMPLETE) == 0 if (err == 0 && (swim3_readbit(fs, SEEK_COMPLETE) == 0
|| swim3_readbit(fs, DISK_IN) == 0)) || swim3_readbit(fs, DISK_IN) == 0))
...@@ -992,8 +990,7 @@ static int floppy_revalidate(struct gendisk *disk) ...@@ -992,8 +990,7 @@ static int floppy_revalidate(struct gendisk *disk)
if (signal_pending(current)) if (signal_pending(current))
break; break;
swim3_select(fs, RELAX); swim3_select(fs, RELAX);
current->state = TASK_INTERRUPTIBLE; schedule_timeout_interruptible(1);
schedule_timeout(1);
} }
ret = swim3_readbit(fs, SEEK_COMPLETE) == 0 ret = swim3_readbit(fs, SEEK_COMPLETE) == 0
|| swim3_readbit(fs, DISK_IN) == 0; || swim3_readbit(fs, DISK_IN) == 0;
......
...@@ -338,8 +338,7 @@ static int swimiop_eject(struct floppy_state *fs) ...@@ -338,8 +338,7 @@ static int swimiop_eject(struct floppy_state *fs)
err = -EINTR; err = -EINTR;
break; break;
} }
current->state = TASK_INTERRUPTIBLE; schedule_timeout_interruptible(1);
schedule_timeout(1);
} }
release_drive(fs); release_drive(fs);
return cmd->error; return cmd->error;
......
...@@ -530,10 +530,8 @@ static inline u_char xd_waitport (u_short port,u_char flags,u_char mask,u_long t ...@@ -530,10 +530,8 @@ static inline u_char xd_waitport (u_short port,u_char flags,u_char mask,u_long t
int success; int success;
xdc_busy = 1; xdc_busy = 1;
while ((success = ((inb(port) & mask) != flags)) && time_before(jiffies, expiry)) { while ((success = ((inb(port) & mask) != flags)) && time_before(jiffies, expiry))
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
}
xdc_busy = 0; xdc_busy = 0;
return (success); return (success);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment