aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/hd.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-07 09:24:39 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 03:50:54 -0400
commit83096ebf1263b2c1ee5e653ba37d993d02e3eb7b (patch)
tree2226b71a616ec1cb2d37511c6a09ba9507a1cd69 /drivers/block/hd.c
parent5b93629b4509c03ffa87a9316412fedf6f58cb37 (diff)
block: convert to pos and nr_sectors accessors
With recent cleanups, there is no place where low level driver directly manipulates request fields. This means that the 'hard' request fields always equal the !hard fields. Convert all rq->sectors, nr_sectors and current_nr_sectors references to accessors. While at it, drop superflous blk_rq_pos() < 0 test in swim.c. [ Impact: use pos and nr_sectors accessors ] Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Tested-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Grant Likely <grant.likely@secretlab.ca> Tested-by: Adrian McMenamin <adrian@mcmen.demon.co.uk> Acked-by: Adrian McMenamin <adrian@mcmen.demon.co.uk> Acked-by: Mike Miller <mike.miller@hp.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Cc: Borislav Petkov <petkovbb@googlemail.com> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: Eric Moore <Eric.Moore@lsi.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Pete Zaitcev <zaitcev@redhat.com> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Paul Clements <paul.clements@steeleye.com> Cc: Tim Waugh <tim@cyberelk.net> Cc: Jeff Garzik <jgarzik@pobox.com> Cc: Jeremy Fitzhardinge <jeremy@xensource.com> Cc: Alex Dubov <oakad@yahoo.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Dario Ballabio <ballabio_dario@emc.com> Cc: David S. Miller <davem@davemloft.net> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: unsik Kim <donari75@gmail.com> Cc: Laurent Vivier <Laurent@lvivier.info> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block/hd.c')
-rw-r--r--drivers/block/hd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/block/hd.c b/drivers/block/hd.c
index 75b9ca95c4eb..a3b39940ce02 100644
--- a/drivers/block/hd.c
+++ b/drivers/block/hd.c
@@ -228,7 +228,7 @@ static void dump_status(const char *msg, unsigned int stat)
228 printk(", CHS=%d/%d/%d", (inb(HD_HCYL)<<8) + inb(HD_LCYL), 228 printk(", CHS=%d/%d/%d", (inb(HD_HCYL)<<8) + inb(HD_LCYL),
229 inb(HD_CURRENT) & 0xf, inb(HD_SECTOR)); 229 inb(HD_CURRENT) & 0xf, inb(HD_SECTOR));
230 if (CURRENT) 230 if (CURRENT)
231 printk(", sector=%ld", CURRENT->sector); 231 printk(", sector=%ld", blk_rq_pos(CURRENT));
232 } 232 }
233 printk("\n"); 233 printk("\n");
234 } 234 }
@@ -457,9 +457,9 @@ ok_to_read:
457 req = CURRENT; 457 req = CURRENT;
458 insw(HD_DATA, req->buffer, 256); 458 insw(HD_DATA, req->buffer, 256);
459#ifdef DEBUG 459#ifdef DEBUG
460 printk("%s: read: sector %ld, remaining = %ld, buffer=%p\n", 460 printk("%s: read: sector %ld, remaining = %u, buffer=%p\n",
461 req->rq_disk->disk_name, req->sector + 1, req->nr_sectors - 1, 461 req->rq_disk->disk_name, blk_rq_pos(req) + 1,
462 req->buffer+512); 462 blk_rq_sectors(req) - 1, req->buffer+512);
463#endif 463#endif
464 if (__blk_end_request(req, 0, 512)) { 464 if (__blk_end_request(req, 0, 512)) {
465 SET_HANDLER(&read_intr); 465 SET_HANDLER(&read_intr);
@@ -485,7 +485,7 @@ static void write_intr(void)
485 continue; 485 continue;
486 if (!OK_STATUS(i)) 486 if (!OK_STATUS(i))
487 break; 487 break;
488 if ((req->nr_sectors <= 1) || (i & DRQ_STAT)) 488 if ((blk_rq_sectors(req) <= 1) || (i & DRQ_STAT))
489 goto ok_to_write; 489 goto ok_to_write;
490 } while (--retries > 0); 490 } while (--retries > 0);
491 dump_status("write_intr", i); 491 dump_status("write_intr", i);
@@ -589,8 +589,8 @@ repeat:
589 return; 589 return;
590 } 590 }
591 disk = req->rq_disk->private_data; 591 disk = req->rq_disk->private_data;
592 block = req->sector; 592 block = blk_rq_pos(req);
593 nsect = req->nr_sectors; 593 nsect = blk_rq_sectors(req);
594 if (block >= get_capacity(req->rq_disk) || 594 if (block >= get_capacity(req->rq_disk) ||
595 ((block+nsect) > get_capacity(req->rq_disk))) { 595 ((block+nsect) > get_capacity(req->rq_disk))) {
596 printk("%s: bad access: block=%d, count=%d\n", 596 printk("%s: bad access: block=%d, count=%d\n",