aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/swim3.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/swim3.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/swim3.c')
-rw-r--r--drivers/block/swim3.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 424855945b9b..c1b9a4dc11ba 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -312,14 +312,14 @@ static void start_request(struct floppy_state *fs)
312 } 312 }
313 while (fs->state == idle && (req = elv_next_request(swim3_queue))) { 313 while (fs->state == idle && (req = elv_next_request(swim3_queue))) {
314#if 0 314#if 0
315 printk("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%ld buf=%p\n", 315 printk("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%u buf=%p\n",
316 req->rq_disk->disk_name, req->cmd, 316 req->rq_disk->disk_name, req->cmd,
317 (long)req->sector, req->nr_sectors, req->buffer); 317 (long)blk_rq_pos(req), blk_rq_sectors(req), req->buffer);
318 printk(" errors=%d current_nr_sectors=%ld\n", 318 printk(" errors=%d current_nr_sectors=%u\n",
319 req->errors, req->current_nr_sectors); 319 req->errors, blk_rq_cur_sectors(req));
320#endif 320#endif
321 321
322 if (req->sector >= fs->total_secs) { 322 if (blk_rq_pos(req) >= fs->total_secs) {
323 __blk_end_request_cur(req, -EIO); 323 __blk_end_request_cur(req, -EIO);
324 continue; 324 continue;
325 } 325 }
@@ -337,13 +337,14 @@ static void start_request(struct floppy_state *fs)
337 } 337 }
338 } 338 }
339 339
340 /* Do not remove the cast. req->sector is now a sector_t and 340 /* Do not remove the cast. blk_rq_pos(req) is now a
341 * can be 64 bits, but it will never go past 32 bits for this 341 * sector_t and can be 64 bits, but it will never go
342 * driver anyway, so we can safely cast it down and not have 342 * past 32 bits for this driver anyway, so we can
343 * to do a 64/32 division 343 * safely cast it down and not have to do a 64/32
344 * division
344 */ 345 */
345 fs->req_cyl = ((long)req->sector) / fs->secpercyl; 346 fs->req_cyl = ((long)blk_rq_pos(req)) / fs->secpercyl;
346 x = ((long)req->sector) % fs->secpercyl; 347 x = ((long)blk_rq_pos(req)) % fs->secpercyl;
347 fs->head = x / fs->secpertrack; 348 fs->head = x / fs->secpertrack;
348 fs->req_sector = x % fs->secpertrack + 1; 349 fs->req_sector = x % fs->secpertrack + 1;
349 fd_req = req; 350 fd_req = req;
@@ -420,7 +421,7 @@ static inline void setup_transfer(struct floppy_state *fs)
420 struct dbdma_cmd *cp = fs->dma_cmd; 421 struct dbdma_cmd *cp = fs->dma_cmd;
421 struct dbdma_regs __iomem *dr = fs->dma; 422 struct dbdma_regs __iomem *dr = fs->dma;
422 423
423 if (fd_req->current_nr_sectors <= 0) { 424 if (blk_rq_cur_sectors(fd_req) <= 0) {
424 printk(KERN_ERR "swim3: transfer 0 sectors?\n"); 425 printk(KERN_ERR "swim3: transfer 0 sectors?\n");
425 return; 426 return;
426 } 427 }
@@ -428,8 +429,8 @@ static inline void setup_transfer(struct floppy_state *fs)
428 n = 1; 429 n = 1;
429 else { 430 else {
430 n = fs->secpertrack - fs->req_sector + 1; 431 n = fs->secpertrack - fs->req_sector + 1;
431 if (n > fd_req->current_nr_sectors) 432 if (n > blk_rq_cur_sectors(fd_req))
432 n = fd_req->current_nr_sectors; 433 n = blk_rq_cur_sectors(fd_req);
433 } 434 }
434 fs->scount = n; 435 fs->scount = n;
435 swim3_select(fs, fs->head? READ_DATA_1: READ_DATA_0); 436 swim3_select(fs, fs->head? READ_DATA_1: READ_DATA_0);
@@ -600,7 +601,8 @@ static void xfer_timeout(unsigned long data)
600 out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION); 601 out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION);
601 out_8(&sw->select, RELAX); 602 out_8(&sw->select, RELAX);
602 printk(KERN_ERR "swim3: timeout %sing sector %ld\n", 603 printk(KERN_ERR "swim3: timeout %sing sector %ld\n",
603 (rq_data_dir(fd_req)==WRITE? "writ": "read"), (long)fd_req->sector); 604 (rq_data_dir(fd_req)==WRITE? "writ": "read"),
605 (long)blk_rq_pos(fd_req));
604 __blk_end_request_cur(fd_req, -EIO); 606 __blk_end_request_cur(fd_req, -EIO);
605 fs->state = idle; 607 fs->state = idle;
606 start_request(fs); 608 start_request(fs);
@@ -714,7 +716,7 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id)
714 } else { 716 } else {
715 printk("swim3: error %sing block %ld (err=%x)\n", 717 printk("swim3: error %sing block %ld (err=%x)\n",
716 rq_data_dir(fd_req) == WRITE? "writ": "read", 718 rq_data_dir(fd_req) == WRITE? "writ": "read",
717 (long)fd_req->sector, err); 719 (long)blk_rq_pos(fd_req), err);
718 __blk_end_request_cur(fd_req, -EIO); 720 __blk_end_request_cur(fd_req, -EIO);
719 fs->state = idle; 721 fs->state = idle;
720 } 722 }