[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: Nishanth Aravamudan <nacc@us.ibm.com> Cc: Jens Axboe <axboe@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
310b587e01
commit
86e8486245
|
@ -1713,10 +1713,9 @@ static unsigned long pollcomplete(int ctlr)
|
|||
|
||||
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 */
|
||||
|
|
|
@ -516,8 +516,7 @@ static int pcd_tray_move(struct cdrom_device_info *cdi, int position)
|
|||
|
||||
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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
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)
|
||||
|
|
|
@ -834,8 +834,7 @@ static int fd_eject(struct floppy_state *fs)
|
|||
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 *inode, struct file *filp)
|
|||
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 gendisk *disk)
|
|||
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;
|
||||
|
|
|
@ -338,8 +338,7 @@ static int swimiop_eject(struct floppy_state *fs)
|
|||
err = -EINTR;
|
||||
break;
|
||||
}
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(1);
|
||||
schedule_timeout_interruptible(1);
|
||||
}
|
||||
release_drive(fs);
|
||||
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
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue