diff options
author | Tejun Heo <tj@kernel.org> | 2009-05-07 09:24:43 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-11 03:50:55 -0400 |
commit | 34b7d2c957199834c474c9d46739265643f4d9c7 (patch) | |
tree | b11b89196c6f1c758657d90a79b496c131b2a19c /drivers/ide/ide-cd.c | |
parent | b0790410300abaaf4f25f702803beff701baebf1 (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/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 25 |
1 files changed, 7 insertions, 18 deletions
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 | ||
708 | out_end: | 708 | out_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 | ||