aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/mg_disk.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/mg_disk.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/mg_disk.c')
-rw-r--r--drivers/block/mg_disk.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 71e56cc28cac..826c3492b9fe 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -220,7 +220,8 @@ static void mg_dump_status(const char *msg, unsigned int stat,
220 if (host->breq) { 220 if (host->breq) {
221 req = elv_next_request(host->breq); 221 req = elv_next_request(host->breq);
222 if (req) 222 if (req)
223 printk(", sector=%u", (u32)req->sector); 223 printk(", sector=%u",
224 (unsigned int)blk_rq_pos(req));
224 } 225 }
225 226
226 } 227 }
@@ -493,12 +494,12 @@ static void mg_read(struct request *req)
493 u32 j; 494 u32 j;
494 struct mg_host *host = req->rq_disk->private_data; 495 struct mg_host *host = req->rq_disk->private_data;
495 496
496 if (mg_out(host, req->sector, req->nr_sectors, MG_CMD_RD, NULL) != 497 if (mg_out(host, blk_rq_pos(req), blk_rq_sectors(req),
497 MG_ERR_NONE) 498 MG_CMD_RD, NULL) != MG_ERR_NONE)
498 mg_bad_rw_intr(host); 499 mg_bad_rw_intr(host);
499 500
500 MG_DBG("requested %d sects (from %ld), buffer=0x%p\n", 501 MG_DBG("requested %d sects (from %ld), buffer=0x%p\n",
501 req->nr_sectors, req->sector, req->buffer); 502 blk_rq_sectors(req), blk_rq_pos(req), req->buffer);
502 503
503 do { 504 do {
504 u16 *buff = (u16 *)req->buffer; 505 u16 *buff = (u16 *)req->buffer;
@@ -522,14 +523,14 @@ static void mg_write(struct request *req)
522 u32 j; 523 u32 j;
523 struct mg_host *host = req->rq_disk->private_data; 524 struct mg_host *host = req->rq_disk->private_data;
524 525
525 if (mg_out(host, req->sector, req->nr_sectors, MG_CMD_WR, NULL) != 526 if (mg_out(host, blk_rq_pos(req), blk_rq_sectors(req),
526 MG_ERR_NONE) { 527 MG_CMD_WR, NULL) != MG_ERR_NONE) {
527 mg_bad_rw_intr(host); 528 mg_bad_rw_intr(host);
528 return; 529 return;
529 } 530 }
530 531
531 MG_DBG("requested %d sects (from %ld), buffer=0x%p\n", 532 MG_DBG("requested %d sects (from %ld), buffer=0x%p\n",
532 req->nr_sectors, req->sector, req->buffer); 533 blk_rq_sectors(req), blk_rq_pos(req), req->buffer);
533 534
534 do { 535 do {
535 u16 *buff = (u16 *)req->buffer; 536 u16 *buff = (u16 *)req->buffer;
@@ -579,7 +580,7 @@ ok_to_read:
579 (i << 1)); 580 (i << 1));
580 581
581 MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n", 582 MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n",
582 req->sector, req->nr_sectors - 1, req->buffer); 583 blk_rq_pos(req), blk_rq_sectors(req) - 1, req->buffer);
583 584
584 /* send read confirm */ 585 /* send read confirm */
585 outb(MG_CMD_RD_CONF, (unsigned long)host->dev_base + MG_REG_COMMAND); 586 outb(MG_CMD_RD_CONF, (unsigned long)host->dev_base + MG_REG_COMMAND);
@@ -609,7 +610,7 @@ static void mg_write_intr(struct mg_host *host)
609 break; 610 break;
610 if (!MG_READY_OK(i)) 611 if (!MG_READY_OK(i))
611 break; 612 break;
612 if ((req->nr_sectors <= 1) || (i & ATA_DRQ)) 613 if ((blk_rq_sectors(req) <= 1) || (i & ATA_DRQ))
613 goto ok_to_write; 614 goto ok_to_write;
614 } while (0); 615 } while (0);
615 mg_dump_status("mg_write_intr", i, host); 616 mg_dump_status("mg_write_intr", i, host);
@@ -627,7 +628,7 @@ ok_to_write:
627 buff++; 628 buff++;
628 } 629 }
629 MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n", 630 MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n",
630 req->sector, req->nr_sectors, req->buffer); 631 blk_rq_pos(req), blk_rq_sectors(req), req->buffer);
631 host->mg_do_intr = mg_write_intr; 632 host->mg_do_intr = mg_write_intr;
632 mod_timer(&host->timer, jiffies + 3 * HZ); 633 mod_timer(&host->timer, jiffies + 3 * HZ);
633 } 634 }
@@ -749,9 +750,9 @@ static void mg_request(struct request_queue *q)
749 750
750 del_timer(&host->timer); 751 del_timer(&host->timer);
751 752
752 sect_num = req->sector; 753 sect_num = blk_rq_pos(req);
753 /* deal whole segments */ 754 /* deal whole segments */
754 sect_cnt = req->nr_sectors; 755 sect_cnt = blk_rq_sectors(req);
755 756
756 /* sanity check */ 757 /* sanity check */
757 if (sect_num >= get_capacity(req->rq_disk) || 758 if (sect_num >= get_capacity(req->rq_disk) ||