diff options
author | Tejun Heo <tj@kernel.org> | 2009-04-28 00:06:06 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-04-28 02:14:50 -0400 |
commit | 5b5c5d12b91cb6b2a2967f06aef35d59008dc2e7 (patch) | |
tree | ea8397d10aaedda61fcc849ce9a7fcab17b5438b /drivers/block | |
parent | 4c94dece1baf320d925cedb231489c4e0358ac5a (diff) |
amiflop,ataflop,xd,mg_disk: clean up unnecessary stuff from block drivers
rq_data_dir() can only be READ or WRITE and rq->sector and nr_sectors
are always automatically updated after partial request completion.
Don't worry about rq_data_dir() not being either READ or WRITE or
manually update sector and nr_sectors.
[ Impact: cleanup ]
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jörg Dorchain <joerg@dorchain.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: unsik Kim <donari75@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/amiflop.c | 7 | ||||
-rw-r--r-- | drivers/block/ataflop.c | 4 | ||||
-rw-r--r-- | drivers/block/mg_disk.c | 10 | ||||
-rw-r--r-- | drivers/block/xd.c | 9 |
4 files changed, 2 insertions, 28 deletions
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index b99a2a606d02..8ff95f2c0ede 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c | |||
@@ -1371,11 +1371,6 @@ static void redo_fd_request(void) | |||
1371 | "0x%08lx\n", track, sector, data); | 1371 | "0x%08lx\n", track, sector, data); |
1372 | #endif | 1372 | #endif |
1373 | 1373 | ||
1374 | if ((rq_data_dir(CURRENT) != READ) && (rq_data_dir(CURRENT) != WRITE)) { | ||
1375 | printk(KERN_WARNING "do_fd_request: unknown command\n"); | ||
1376 | __blk_end_request_cur(CURRENT, -EIO); | ||
1377 | goto repeat; | ||
1378 | } | ||
1379 | if (get_track(drive, track) == -1) { | 1374 | if (get_track(drive, track) == -1) { |
1380 | __blk_end_request_cur(CURRENT, -EIO); | 1375 | __blk_end_request_cur(CURRENT, -EIO); |
1381 | goto repeat; | 1376 | goto repeat; |
@@ -1407,8 +1402,6 @@ static void redo_fd_request(void) | |||
1407 | break; | 1402 | break; |
1408 | } | 1403 | } |
1409 | } | 1404 | } |
1410 | CURRENT->nr_sectors -= CURRENT->current_nr_sectors; | ||
1411 | CURRENT->sector += CURRENT->current_nr_sectors; | ||
1412 | 1405 | ||
1413 | __blk_end_request_cur(CURRENT, 0); | 1406 | __blk_end_request_cur(CURRENT, 0); |
1414 | goto repeat; | 1407 | goto repeat; |
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 44a8702136a9..25067287211f 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -732,8 +732,6 @@ static void do_fd_action( int drive ) | |||
732 | } | 732 | } |
733 | else { | 733 | else { |
734 | /* all sectors finished */ | 734 | /* all sectors finished */ |
735 | CURRENT->nr_sectors -= CURRENT->current_nr_sectors; | ||
736 | CURRENT->sector += CURRENT->current_nr_sectors; | ||
737 | __blk_end_request_cur(CURRENT, 0); | 735 | __blk_end_request_cur(CURRENT, 0); |
738 | redo_fd_request(); | 736 | redo_fd_request(); |
739 | return; | 737 | return; |
@@ -1139,8 +1137,6 @@ static void fd_rwsec_done1(int status) | |||
1139 | } | 1137 | } |
1140 | else { | 1138 | else { |
1141 | /* all sectors finished */ | 1139 | /* all sectors finished */ |
1142 | CURRENT->nr_sectors -= CURRENT->current_nr_sectors; | ||
1143 | CURRENT->sector += CURRENT->current_nr_sectors; | ||
1144 | __blk_end_request_cur(CURRENT, 0); | 1140 | __blk_end_request_cur(CURRENT, 0); |
1145 | redo_fd_request(); | 1141 | redo_fd_request(); |
1146 | } | 1142 | } |
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index 408c2bd8a439..2c00ad90cd62 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c | |||
@@ -560,11 +560,6 @@ static void mg_request_poll(struct request_queue *q) | |||
560 | case WRITE: | 560 | case WRITE: |
561 | mg_write(req); | 561 | mg_write(req); |
562 | break; | 562 | break; |
563 | default: | ||
564 | printk(KERN_WARNING "%s:%d unknown command\n", | ||
565 | __func__, __LINE__); | ||
566 | __blk_end_request_cur(req, -EIO); | ||
567 | break; | ||
568 | } | 563 | } |
569 | } | 564 | } |
570 | } | 565 | } |
@@ -614,11 +609,6 @@ static unsigned int mg_issue_req(struct request *req, | |||
614 | outb(MG_CMD_WR_CONF, (unsigned long)host->dev_base + | 609 | outb(MG_CMD_WR_CONF, (unsigned long)host->dev_base + |
615 | MG_REG_COMMAND); | 610 | MG_REG_COMMAND); |
616 | break; | 611 | break; |
617 | default: | ||
618 | printk(KERN_WARNING "%s:%d unknown command\n", | ||
619 | __func__, __LINE__); | ||
620 | __blk_end_request_cur(req, -EIO); | ||
621 | break; | ||
622 | } | 612 | } |
623 | return MG_ERR_NONE; | 613 | return MG_ERR_NONE; |
624 | } | 614 | } |
diff --git a/drivers/block/xd.c b/drivers/block/xd.c index 6f6ad82ec0c0..14be4c1ed1aa 100644 --- a/drivers/block/xd.c +++ b/drivers/block/xd.c | |||
@@ -308,7 +308,6 @@ static void do_xd_request (struct request_queue * q) | |||
308 | while ((req = elv_next_request(q)) != NULL) { | 308 | while ((req = elv_next_request(q)) != NULL) { |
309 | unsigned block = req->sector; | 309 | unsigned block = req->sector; |
310 | unsigned count = req->nr_sectors; | 310 | unsigned count = req->nr_sectors; |
311 | int rw = rq_data_dir(req); | ||
312 | XD_INFO *disk = req->rq_disk->private_data; | 311 | XD_INFO *disk = req->rq_disk->private_data; |
313 | int res = 0; | 312 | int res = 0; |
314 | int retry; | 313 | int retry; |
@@ -321,13 +320,9 @@ static void do_xd_request (struct request_queue * q) | |||
321 | __blk_end_request_cur(req, -EIO); | 320 | __blk_end_request_cur(req, -EIO); |
322 | continue; | 321 | continue; |
323 | } | 322 | } |
324 | if (rw != READ && rw != WRITE) { | ||
325 | printk("do_xd_request: unknown request\n"); | ||
326 | __blk_end_request_cur(req, -EIO); | ||
327 | continue; | ||
328 | } | ||
329 | for (retry = 0; (retry < XD_RETRIES) && !res; retry++) | 323 | for (retry = 0; (retry < XD_RETRIES) && !res; retry++) |
330 | res = xd_readwrite(rw, disk, req->buffer, block, count); | 324 | res = xd_readwrite(rq_data_dir(req), disk, req->buffer, |
325 | block, count); | ||
331 | /* wrap up, 0 = success, -errno = fail */ | 326 | /* wrap up, 0 = success, -errno = fail */ |
332 | __blk_end_request_cur(req, res); | 327 | __blk_end_request_cur(req, res); |
333 | } | 328 | } |