Commit 5b5c5d12 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

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: default avatarTejun 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: default avatarJens Axboe <jens.axboe@oracle.com>
parent 4c94dece
...@@ -1371,11 +1371,6 @@ static void redo_fd_request(void) ...@@ -1371,11 +1371,6 @@ static void redo_fd_request(void)
"0x%08lx\n", track, sector, data); "0x%08lx\n", track, sector, data);
#endif #endif
if ((rq_data_dir(CURRENT) != READ) && (rq_data_dir(CURRENT) != WRITE)) {
printk(KERN_WARNING "do_fd_request: unknown command\n");
__blk_end_request_cur(CURRENT, -EIO);
goto repeat;
}
if (get_track(drive, track) == -1) { if (get_track(drive, track) == -1) {
__blk_end_request_cur(CURRENT, -EIO); __blk_end_request_cur(CURRENT, -EIO);
goto repeat; goto repeat;
...@@ -1407,8 +1402,6 @@ static void redo_fd_request(void) ...@@ -1407,8 +1402,6 @@ static void redo_fd_request(void)
break; break;
} }
} }
CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
CURRENT->sector += CURRENT->current_nr_sectors;
__blk_end_request_cur(CURRENT, 0); __blk_end_request_cur(CURRENT, 0);
goto repeat; goto repeat;
......
...@@ -732,8 +732,6 @@ static void do_fd_action( int drive ) ...@@ -732,8 +732,6 @@ static void do_fd_action( int drive )
} }
else { else {
/* all sectors finished */ /* all sectors finished */
CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
CURRENT->sector += CURRENT->current_nr_sectors;
__blk_end_request_cur(CURRENT, 0); __blk_end_request_cur(CURRENT, 0);
redo_fd_request(); redo_fd_request();
return; return;
...@@ -1139,8 +1137,6 @@ static void fd_rwsec_done1(int status) ...@@ -1139,8 +1137,6 @@ static void fd_rwsec_done1(int status)
} }
else { else {
/* all sectors finished */ /* all sectors finished */
CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
CURRENT->sector += CURRENT->current_nr_sectors;
__blk_end_request_cur(CURRENT, 0); __blk_end_request_cur(CURRENT, 0);
redo_fd_request(); redo_fd_request();
} }
......
...@@ -560,11 +560,6 @@ static void mg_request_poll(struct request_queue *q) ...@@ -560,11 +560,6 @@ static void mg_request_poll(struct request_queue *q)
case WRITE: case WRITE:
mg_write(req); mg_write(req);
break; break;
default:
printk(KERN_WARNING "%s:%d unknown command\n",
__func__, __LINE__);
__blk_end_request_cur(req, -EIO);
break;
} }
} }
} }
...@@ -614,11 +609,6 @@ static unsigned int mg_issue_req(struct request *req, ...@@ -614,11 +609,6 @@ static unsigned int mg_issue_req(struct request *req,
outb(MG_CMD_WR_CONF, (unsigned long)host->dev_base + outb(MG_CMD_WR_CONF, (unsigned long)host->dev_base +
MG_REG_COMMAND); MG_REG_COMMAND);
break; break;
default:
printk(KERN_WARNING "%s:%d unknown command\n",
__func__, __LINE__);
__blk_end_request_cur(req, -EIO);
break;
} }
return MG_ERR_NONE; return MG_ERR_NONE;
} }
......
...@@ -308,7 +308,6 @@ static void do_xd_request (struct request_queue * q) ...@@ -308,7 +308,6 @@ static void do_xd_request (struct request_queue * q)
while ((req = elv_next_request(q)) != NULL) { while ((req = elv_next_request(q)) != NULL) {
unsigned block = req->sector; unsigned block = req->sector;
unsigned count = req->nr_sectors; unsigned count = req->nr_sectors;
int rw = rq_data_dir(req);
XD_INFO *disk = req->rq_disk->private_data; XD_INFO *disk = req->rq_disk->private_data;
int res = 0; int res = 0;
int retry; int retry;
...@@ -321,13 +320,9 @@ static void do_xd_request (struct request_queue * q) ...@@ -321,13 +320,9 @@ static void do_xd_request (struct request_queue * q)
__blk_end_request_cur(req, -EIO); __blk_end_request_cur(req, -EIO);
continue; continue;
} }
if (rw != READ && rw != WRITE) {
printk("do_xd_request: unknown request\n");
__blk_end_request_cur(req, -EIO);
continue;
}
for (retry = 0; (retry < XD_RETRIES) && !res; retry++) for (retry = 0; (retry < XD_RETRIES) && !res; retry++)
res = xd_readwrite(rw, disk, req->buffer, block, count); res = xd_readwrite(rq_data_dir(req), disk, req->buffer,
block, count);
/* wrap up, 0 = success, -errno = fail */ /* wrap up, 0 = success, -errno = fail */
__blk_end_request_cur(req, res); __blk_end_request_cur(req, res);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment