diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-07-15 15:21:43 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-15 15:21:43 -0400 |
commit | 64ea1b4ab7f51c5de601d291a51508c27d445f70 (patch) | |
tree | f0637ace079759b3e128c1d595036729bf895742 /drivers/ide/ide-tape.c | |
parent | 154ed280e3f48995d0689b57f10b7063add63019 (diff) |
ide-tape: convert ide_do_drive_cmd path to use blk_execute_rq
This converts the ide_do_drive_cmd path using ide_wait to use
blk_execute_rq.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index d67a17891786..a5f0b774527b 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -1519,12 +1519,16 @@ static void idetape_create_test_unit_ready_cmd(struct ide_atapi_pc *pc) | |||
1519 | static int idetape_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc) | 1519 | static int idetape_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc) |
1520 | { | 1520 | { |
1521 | struct ide_tape_obj *tape = drive->driver_data; | 1521 | struct ide_tape_obj *tape = drive->driver_data; |
1522 | struct request rq; | 1522 | struct request *rq; |
1523 | int error; | ||
1523 | 1524 | ||
1524 | idetape_init_rq(&rq, REQ_IDETAPE_PC1); | 1525 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); |
1525 | rq.buffer = (char *) pc; | 1526 | rq->cmd_type = REQ_TYPE_SPECIAL; |
1526 | rq.rq_disk = tape->disk; | 1527 | rq->cmd[0] = REQ_IDETAPE_PC1; |
1527 | return ide_do_drive_cmd(drive, &rq, ide_wait); | 1528 | rq->buffer = (char *)pc; |
1529 | error = blk_execute_rq(drive->queue, tape->disk, rq, 0); | ||
1530 | blk_put_request(rq); | ||
1531 | return error; | ||
1528 | } | 1532 | } |
1529 | 1533 | ||
1530 | static void idetape_create_load_unload_cmd(ide_drive_t *drive, | 1534 | static void idetape_create_load_unload_cmd(ide_drive_t *drive, |
@@ -1701,26 +1705,33 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks, | |||
1701 | struct idetape_bh *bh) | 1705 | struct idetape_bh *bh) |
1702 | { | 1706 | { |
1703 | idetape_tape_t *tape = drive->driver_data; | 1707 | idetape_tape_t *tape = drive->driver_data; |
1704 | struct request rq; | 1708 | struct request *rq; |
1709 | int ret, errors; | ||
1705 | 1710 | ||
1706 | debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd); | 1711 | debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd); |
1707 | 1712 | ||
1708 | idetape_init_rq(&rq, cmd); | 1713 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); |
1709 | rq.rq_disk = tape->disk; | 1714 | rq->cmd_type = REQ_TYPE_SPECIAL; |
1710 | rq.special = (void *)bh; | 1715 | rq->cmd[0] = cmd; |
1711 | rq.sector = tape->first_frame; | 1716 | rq->rq_disk = tape->disk; |
1712 | rq.nr_sectors = blocks; | 1717 | rq->special = (void *)bh; |
1713 | rq.current_nr_sectors = blocks; | 1718 | rq->sector = tape->first_frame; |
1714 | (void) ide_do_drive_cmd(drive, &rq, ide_wait); | 1719 | rq->nr_sectors = blocks; |
1720 | rq->current_nr_sectors = blocks; | ||
1721 | blk_execute_rq(drive->queue, tape->disk, rq, 0); | ||
1722 | |||
1723 | errors = rq->errors; | ||
1724 | ret = tape->blk_size * (blocks - rq->current_nr_sectors); | ||
1725 | blk_put_request(rq); | ||
1715 | 1726 | ||
1716 | if ((cmd & (REQ_IDETAPE_READ | REQ_IDETAPE_WRITE)) == 0) | 1727 | if ((cmd & (REQ_IDETAPE_READ | REQ_IDETAPE_WRITE)) == 0) |
1717 | return 0; | 1728 | return 0; |
1718 | 1729 | ||
1719 | if (tape->merge_bh) | 1730 | if (tape->merge_bh) |
1720 | idetape_init_merge_buffer(tape); | 1731 | idetape_init_merge_buffer(tape); |
1721 | if (rq.errors == IDETAPE_ERROR_GENERAL) | 1732 | if (errors == IDETAPE_ERROR_GENERAL) |
1722 | return -EIO; | 1733 | return -EIO; |
1723 | return (tape->blk_size * (blocks-rq.current_nr_sectors)); | 1734 | return ret; |
1724 | } | 1735 | } |
1725 | 1736 | ||
1726 | static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc) | 1737 | static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc) |