summaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-atapi.c
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@gmail.com>2009-05-01 21:21:02 +0200
committerBorislav Petkov <petkovbb@gmail.com>2009-05-15 06:44:02 +0200
commit077e6dba20e74a455a0452379d2a965c7e1b01ad (patch)
tree66b4a755d6e5941578d5a14b778b0734273343c5 /drivers/ide/ide-atapi.c
parentdfb7e621fa12c0579e88560ab176c5768f9e0bfb (diff)
ide-atapi: switch to rq->resid_len
Now that we have rq->resid_len, use it to account partial completion amount during the lifetime of an rq, decrementing it on each successful transfer. As a result, get rid of now unused pc->xferred. While at it, remove noisy debug call in ide_prep_sense. Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 7129495b3e4..1022e421abd 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -172,8 +172,6 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq)
unsigned int cmd_len, sense_len;
int err;
- debug_log("%s: enter\n", __func__);
-
switch (drive->media) {
case ide_floppy:
cmd_len = 255;
@@ -370,7 +368,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
? "write" : "read");
pc->flags |= PC_FLAG_DMA_ERROR;
} else
- pc->xferred = blk_rq_bytes(rq);
+ rq->resid_len = 0;
debug_log("%s: DMA finished\n", drive->name);
}
@@ -379,7 +377,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
int uptodate, error;
debug_log("Packet command completed, %d bytes transferred\n",
- pc->xferred);
+ blk_rq_bytes(rq));
pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
@@ -467,15 +465,15 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
ide_pio_bytes(drive, cmd, write, done);
/* Update transferred byte count */
- pc->xferred += done;
+ rq->resid_len -= done;
bcount -= done;
if (bcount)
ide_pad_transfer(drive, write, bcount);
- debug_log("[cmd %x] transferred %d bytes, padded %d bytes\n",
- rq->cmd[0], done, bcount);
+ debug_log("[cmd %x] transferred %d bytes, padded %d bytes, resid: %u\n",
+ rq->cmd[0], done, bcount, rq->resid_len);
/* And set the interrupt handler again */
ide_set_handler(drive, ide_pc_intr, timeout);
@@ -643,16 +641,15 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd)
} else {
pc = drive->pc;
- /* We haven't transferred any data yet */
- pc->xferred = 0;
-
valid_tf = IDE_VALID_DEVICE;
bytes = blk_rq_bytes(rq);
-
bcount = ((drive->media == ide_tape) ? bytes
: min_t(unsigned int,
bytes, 63 * 1024));
+ /* We haven't transferred any data yet */
+ rq->resid_len = bcount;
+
if (pc->flags & PC_FLAG_DMA_ERROR) {
pc->flags &= ~PC_FLAG_DMA_ERROR;
ide_dma_off(drive);