aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-07 09:24:43 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 03:50:55 -0400
commit34b7d2c957199834c474c9d46739265643f4d9c7 (patch)
treeb11b89196c6f1c758657d90a79b496c131b2a19c /drivers/ide
parentb0790410300abaaf4f25f702803beff701baebf1 (diff)
ide: cleanup rq->data_len usages
With recent unification of fields, it's now guaranteed that rq->data_len always equals blk_rq_bytes(). Convert all direct users to accessors. [ Impact: convert direct rq->data_len usages to blk_rq_bytes() ] Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Cc: Borislav Petkov <petkovbb@googlemail.com> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-atapi.c4
-rw-r--r--drivers/ide/ide-cd.c25
-rw-r--r--drivers/ide/ide-floppy.c4
-rw-r--r--drivers/ide/ide-io.c2
-rw-r--r--drivers/ide/ide-tape.c2
5 files changed, 13 insertions, 24 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index e4a02a05fc81..792534db8f85 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -255,7 +255,7 @@ void ide_retry_pc(ide_drive_t *drive)
255 ide_init_pc(pc); 255 ide_init_pc(pc);
256 memcpy(pc->c, sense_rq->cmd, 12); 256 memcpy(pc->c, sense_rq->cmd, 12);
257 pc->buf = bio_data(sense_rq->bio); /* pointer to mapped address */ 257 pc->buf = bio_data(sense_rq->bio); /* pointer to mapped address */
258 pc->req_xfer = sense_rq->data_len; 258 pc->req_xfer = blk_rq_bytes(sense_rq);
259 259
260 if (drive->media == ide_tape) 260 if (drive->media == ide_tape)
261 set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); 261 set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
@@ -303,7 +303,7 @@ int ide_cd_get_xferlen(struct request *rq)
303 return 32768; 303 return 32768;
304 else if (blk_sense_request(rq) || blk_pc_request(rq) || 304 else if (blk_sense_request(rq) || blk_pc_request(rq) ||
305 rq->cmd_type == REQ_TYPE_ATA_PC) 305 rq->cmd_type == REQ_TYPE_ATA_PC)
306 return rq->data_len; 306 return blk_rq_bytes(rq);
307 else 307 else
308 return 0; 308 return 0;
309} 309}
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index eb4f3dc9f182..2eadc9d2e965 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -577,7 +577,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
577 struct request *rq = hwif->rq; 577 struct request *rq = hwif->rq;
578 ide_expiry_t *expiry = NULL; 578 ide_expiry_t *expiry = NULL;
579 int dma_error = 0, dma, thislen, uptodate = 0; 579 int dma_error = 0, dma, thislen, uptodate = 0;
580 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0, nsectors; 580 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0;
581 int sense = blk_sense_request(rq); 581 int sense = blk_sense_request(rq);
582 unsigned int timeout; 582 unsigned int timeout;
583 u16 len; 583 u16 len;
@@ -707,9 +707,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
707 707
708out_end: 708out_end:
709 if (blk_pc_request(rq) && rc == 0) { 709 if (blk_pc_request(rq) && rc == 0) {
710 if (blk_end_request(rq, 0, rq->data_len)) 710 blk_end_request_all(rq, 0);
711 BUG();
712
713 hwif->rq = NULL; 711 hwif->rq = NULL;
714 } else { 712 } else {
715 if (sense && uptodate) 713 if (sense && uptodate)
@@ -727,22 +725,14 @@ out_end:
727 ide_cd_error_cmd(drive, cmd); 725 ide_cd_error_cmd(drive, cmd);
728 726
729 /* make sure it's fully ended */ 727 /* make sure it's fully ended */
730 if (blk_pc_request(rq))
731 nsectors = (rq->data_len + 511) >> 9;
732 else
733 nsectors = blk_rq_sectors(rq);
734
735 if (nsectors == 0)
736 nsectors = 1;
737
738 if (blk_fs_request(rq) == 0) { 728 if (blk_fs_request(rq) == 0) {
739 rq->resid_len = rq->data_len - 729 rq->resid_len = blk_rq_bytes(rq) -
740 (cmd->nbytes - cmd->nleft); 730 (cmd->nbytes - cmd->nleft);
741 if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) 731 if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE))
742 rq->resid_len += cmd->last_xfer_len; 732 rq->resid_len += cmd->last_xfer_len;
743 } 733 }
744 734
745 ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9); 735 ide_complete_rq(drive, uptodate ? 0 : -EIO, blk_rq_bytes(rq));
746 736
747 if (sense && rc == 2) 737 if (sense && rc == 2)
748 ide_error(drive, "request sense failure", stat); 738 ide_error(drive, "request sense failure", stat);
@@ -819,7 +809,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
819 */ 809 */
820 alignment = queue_dma_alignment(q) | q->dma_pad_mask; 810 alignment = queue_dma_alignment(q) | q->dma_pad_mask;
821 if ((unsigned long)buf & alignment 811 if ((unsigned long)buf & alignment
822 || rq->data_len & q->dma_pad_mask 812 || blk_rq_bytes(rq) & q->dma_pad_mask
823 || object_is_on_stack(buf)) 813 || object_is_on_stack(buf))
824 drive->dma = 0; 814 drive->dma = 0;
825 } 815 }
@@ -867,9 +857,8 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
867 857
868 cmd.rq = rq; 858 cmd.rq = rq;
869 859
870 if (blk_fs_request(rq) || rq->data_len) { 860 if (blk_fs_request(rq) || blk_rq_bytes(rq)) {
871 ide_init_sg_cmd(&cmd, blk_fs_request(rq) ? 861 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq));
872 (blk_rq_sectors(rq) << 9) : rq->data_len);
873 ide_map_sg(drive, &cmd); 862 ide_map_sg(drive, &cmd);
874 } 863 }
875 864
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 1c460bd56375..650981758f15 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -220,14 +220,14 @@ static void idefloppy_blockpc_cmd(struct ide_disk_obj *floppy,
220 ide_init_pc(pc); 220 ide_init_pc(pc);
221 memcpy(pc->c, rq->cmd, sizeof(pc->c)); 221 memcpy(pc->c, rq->cmd, sizeof(pc->c));
222 pc->rq = rq; 222 pc->rq = rq;
223 if (rq->data_len) { 223 if (blk_rq_bytes(rq)) {
224 pc->flags |= PC_FLAG_DMA_OK; 224 pc->flags |= PC_FLAG_DMA_OK;
225 if (rq_data_dir(rq) == WRITE) 225 if (rq_data_dir(rq) == WRITE)
226 pc->flags |= PC_FLAG_WRITING; 226 pc->flags |= PC_FLAG_WRITING;
227 } 227 }
228 /* pio will be performed by ide_pio_bytes() which handles sg fine */ 228 /* pio will be performed by ide_pio_bytes() which handles sg fine */
229 pc->buf = NULL; 229 pc->buf = NULL;
230 pc->req_xfer = pc->buf_size = rq->data_len; 230 pc->req_xfer = pc->buf_size = blk_rq_bytes(rq);
231} 231}
232 232
233static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, 233static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 59799ca55246..ca2519d7b994 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -116,7 +116,7 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
116unsigned int ide_rq_bytes(struct request *rq) 116unsigned int ide_rq_bytes(struct request *rq)
117{ 117{
118 if (blk_pc_request(rq)) 118 if (blk_pc_request(rq))
119 return rq->data_len; 119 return blk_rq_bytes(rq);
120 else 120 else
121 return blk_rq_cur_sectors(rq) << 9; 121 return blk_rq_cur_sectors(rq) << 9;
122} 122}
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index c6cf3a951f28..e16604562f28 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -380,7 +380,7 @@ static int ide_tape_callback(ide_drive_t *drive, int dsc)
380 } 380 }
381 381
382 tape->first_frame += blocks; 382 tape->first_frame += blocks;
383 rq->resid_len = rq->data_len - blocks * tape->blk_size; 383 rq->resid_len = blk_rq_bytes(rq) - blocks * tape->blk_size;
384 384
385 if (pc->error) { 385 if (pc->error) {
386 uptodate = 0; 386 uptodate = 0;