aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-taskfile.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-04-18 18:00:42 -0400
committerTejun Heo <tj@kernel.org>2009-04-18 18:00:42 -0400
commiteace4cb04c0edc9388e987bf9bbdef461f6daca4 (patch)
tree3cd10182940039df2c99b0029ae0badf6fc5ada1 /drivers/ide/ide-taskfile.c
parent7f006dc24fae158131116c9472874f12e16cf040 (diff)
ide-taskfile: don't abuse rq->buffer
Impact: rq->buffer usage cleanup ide_raw_taskfile() directly uses rq->buffer to carry pointer to the data buffer. This complicates both block interface and ide backend request handling. Use blk_rq_map_kern() instead and drop special handling for REQ_TYPE_ATA_TASKFILE from ide_map_sg(). Note that REQ_RW setting is moved upwards as blk_rq_map_kern() uses it to initialize bio rw flag. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/ide/ide-taskfile.c')
-rw-r--r--drivers/ide/ide-taskfile.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 4aa6223c11be..f400eb4d4aff 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -424,7 +424,9 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
424 424
425 rq = blk_get_request(drive->queue, READ, __GFP_WAIT); 425 rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
426 rq->cmd_type = REQ_TYPE_ATA_TASKFILE; 426 rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
427 rq->buffer = buf; 427
428 if (cmd->tf_flags & IDE_TFLAG_WRITE)
429 rq->cmd_flags |= REQ_RW;
428 430
429 /* 431 /*
430 * (ks) We transfer currently only whole sectors. 432 * (ks) We transfer currently only whole sectors.
@@ -432,18 +434,20 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
432 * if we would find a solution to transfer any size. 434 * if we would find a solution to transfer any size.
433 * To support special commands like READ LONG. 435 * To support special commands like READ LONG.
434 */ 436 */
435 rq->hard_nr_sectors = rq->nr_sectors = nsect; 437 if (nsect) {
436 rq->hard_cur_sectors = rq->current_nr_sectors = nsect; 438 error = blk_rq_map_kern(drive->queue, rq, buf,
437 439 nsect * SECTOR_SIZE, __GFP_WAIT);
438 if (cmd->tf_flags & IDE_TFLAG_WRITE) 440 if (error)
439 rq->cmd_flags |= REQ_RW; 441 goto put_req;
442 }
440 443
441 rq->special = cmd; 444 rq->special = cmd;
442 cmd->rq = rq; 445 cmd->rq = rq;
443 446
444 error = blk_execute_rq(drive->queue, NULL, rq, 0); 447 error = blk_execute_rq(drive->queue, NULL, rq, 0);
445 blk_put_request(rq);
446 448
449put_req:
450 blk_put_request(rq);
447 return error; 451 return error;
448} 452}
449 453