Skip to content

Commit

Permalink
[PATCH] drivers/block: fix-up schedule_timeout() usage
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nishanth Aravamudan authored and Linus Torvalds committed Sep 10, 2005
1 parent 310b587 commit 86e8486
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 24 deletions.
7 changes: 3 additions & 4 deletions drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
3 changes: 1 addition & 2 deletions drivers/block/paride/pcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions drivers/block/paride/pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions drivers/block/paride/pg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions drivers/block/paride/pt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 3 additions & 6 deletions drivers/block/swim3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions drivers/block/swim_iop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions drivers/block/xd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 86e8486

Please sign in to comment.