aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-07 09:24:38 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 03:50:53 -0400
commit5b93629b4509c03ffa87a9316412fedf6f58cb37 (patch)
treead5ceda3f718361b8df3057b4f9edcc79aa4cd9d /drivers/ide
parentc3a4d78c580de4edc9ef0f7c59812fb02ceb037f (diff)
block: implement blk_rq_pos/[cur_]sectors() and convert obvious ones
Implement accessors - blk_rq_pos(), blk_rq_sectors() and blk_rq_cur_sectors() which return rq->hard_sector, rq->hard_nr_sectors and rq->hard_cur_sectors respectively and convert direct references of the said fields to the accessors. This is in preparation of request data length handling cleanup. Geert : suggested adding const to struct request * parameter to accessors Sergei : spotted error in patch description [ Impact: cleanup ] Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Acked-by: Stephen Rothwell <sfr@canb.auug.org.au> Tested-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Grant Likely <grant.likely@secretlab.ca> Ackec-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Cc: Borislav Petkov <petkovbb@googlemail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cd.c8
-rw-r--r--drivers/ide/ide-io.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 8bbe222c5e42..182320dd6ea1 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -730,7 +730,7 @@ out_end:
730 if (blk_pc_request(rq)) 730 if (blk_pc_request(rq))
731 nsectors = (rq->data_len + 511) >> 9; 731 nsectors = (rq->data_len + 511) >> 9;
732 else 732 else
733 nsectors = rq->hard_nr_sectors; 733 nsectors = blk_rq_sectors(rq);
734 734
735 if (nsectors == 0) 735 if (nsectors == 0)
736 nsectors = 1; 736 nsectors = 1;
@@ -875,7 +875,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
875 875
876 return ide_issue_pc(drive, &cmd); 876 return ide_issue_pc(drive, &cmd);
877out_end: 877out_end:
878 nsectors = rq->hard_nr_sectors; 878 nsectors = blk_rq_sectors(rq);
879 879
880 if (nsectors == 0) 880 if (nsectors == 0)
881 nsectors = 1; 881 nsectors = 1;
@@ -1359,8 +1359,8 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
1359static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq) 1359static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq)
1360{ 1360{
1361 int hard_sect = queue_hardsect_size(q); 1361 int hard_sect = queue_hardsect_size(q);
1362 long block = (long)rq->hard_sector / (hard_sect >> 9); 1362 long block = (long)blk_rq_pos(rq) / (hard_sect >> 9);
1363 unsigned long blocks = rq->hard_nr_sectors / (hard_sect >> 9); 1363 unsigned long blocks = blk_rq_sectors(rq) / (hard_sect >> 9);
1364 1364
1365 memset(rq->cmd, 0, BLK_MAX_CDB); 1365 memset(rq->cmd, 0, BLK_MAX_CDB);
1366 1366
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index a0309ea661ac..df23bcbd94b4 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -118,7 +118,7 @@ unsigned int ide_rq_bytes(struct request *rq)
118 if (blk_pc_request(rq)) 118 if (blk_pc_request(rq))
119 return rq->data_len; 119 return rq->data_len;
120 else 120 else
121 return rq->hard_cur_sectors << 9; 121 return blk_rq_cur_sectors(rq) << 9;
122} 122}
123EXPORT_SYMBOL_GPL(ide_rq_bytes); 123EXPORT_SYMBOL_GPL(ide_rq_bytes);
124 124
@@ -133,7 +133,7 @@ int ide_complete_rq(ide_drive_t *drive, int error, unsigned int nr_bytes)
133 * and complete the whole request right now 133 * and complete the whole request right now
134 */ 134 */
135 if (blk_noretry_request(rq) && error <= 0) 135 if (blk_noretry_request(rq) && error <= 0)
136 nr_bytes = rq->hard_nr_sectors << 9; 136 nr_bytes = blk_rq_sectors(rq) << 9;
137 137
138 rc = ide_end_rq(drive, rq, error, nr_bytes); 138 rc = ide_end_rq(drive, rq, error, nr_bytes);
139 if (rc == 0) 139 if (rc == 0)