diff options
author | Borislav Petkov <petkovbb@googlemail.com> | 2008-07-23 13:56:00 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:56:00 -0400 |
commit | 0014c75be31d9fa7435105afa9960374a82cc55c (patch) | |
tree | f92caeca97cf2b133e2e772d8745f57b50bb9524 | |
parent | 83dd573513471c67f9cc93a88795c25a91ebf4b3 (diff) |
ide-tape: pass packet command in rq->cmd
Make a redundant copy of the packet command bits into rq->cmd. Later, after
all drivers have been converted, it'll be switched to use that in the
common code instead of pc->c. While at it, simplify ide_tape_create_rw_cmd.
There should be no functionality change resulting from this patch.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-tape.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index f43ffb88d844..a6d4e484aaeb 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -730,6 +730,7 @@ static void idetape_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc, | |||
730 | rq->cmd_flags |= REQ_PREEMPT; | 730 | rq->cmd_flags |= REQ_PREEMPT; |
731 | rq->buffer = (char *) pc; | 731 | rq->buffer = (char *) pc; |
732 | rq->rq_disk = tape->disk; | 732 | rq->rq_disk = tape->disk; |
733 | memcpy(rq->cmd, pc->c, 12); | ||
733 | ide_do_drive_cmd(drive, rq); | 734 | ide_do_drive_cmd(drive, rq); |
734 | } | 735 | } |
735 | 736 | ||
@@ -952,9 +953,12 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive) | |||
952 | } | 953 | } |
953 | 954 | ||
954 | static void ide_tape_create_rw_cmd(idetape_tape_t *tape, | 955 | static void ide_tape_create_rw_cmd(idetape_tape_t *tape, |
955 | struct ide_atapi_pc *pc, unsigned int length, | 956 | struct ide_atapi_pc *pc, struct request *rq, |
956 | struct idetape_bh *bh, u8 opcode) | 957 | u8 opcode) |
957 | { | 958 | { |
959 | struct idetape_bh *bh = (struct idetape_bh *)rq->special; | ||
960 | unsigned int length = rq->current_nr_sectors; | ||
961 | |||
958 | idetape_init_pc(pc); | 962 | idetape_init_pc(pc); |
959 | put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); | 963 | put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); |
960 | pc->c[1] = 1; | 964 | pc->c[1] = 1; |
@@ -974,6 +978,8 @@ static void ide_tape_create_rw_cmd(idetape_tape_t *tape, | |||
974 | pc->b_data = bh->b_data; | 978 | pc->b_data = bh->b_data; |
975 | pc->b_count = atomic_read(&bh->b_count); | 979 | pc->b_count = atomic_read(&bh->b_count); |
976 | } | 980 | } |
981 | |||
982 | memcpy(rq->cmd, pc->c, 12); | ||
977 | } | 983 | } |
978 | 984 | ||
979 | static ide_startstop_t idetape_do_request(ide_drive_t *drive, | 985 | static ide_startstop_t idetape_do_request(ide_drive_t *drive, |
@@ -1051,16 +1057,12 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
1051 | } | 1057 | } |
1052 | if (rq->cmd[13] & REQ_IDETAPE_READ) { | 1058 | if (rq->cmd[13] & REQ_IDETAPE_READ) { |
1053 | pc = idetape_next_pc_storage(drive); | 1059 | pc = idetape_next_pc_storage(drive); |
1054 | ide_tape_create_rw_cmd(tape, pc, rq->current_nr_sectors, | 1060 | ide_tape_create_rw_cmd(tape, pc, rq, READ_6); |
1055 | (struct idetape_bh *)rq->special, | ||
1056 | READ_6); | ||
1057 | goto out; | 1061 | goto out; |
1058 | } | 1062 | } |
1059 | if (rq->cmd[13] & REQ_IDETAPE_WRITE) { | 1063 | if (rq->cmd[13] & REQ_IDETAPE_WRITE) { |
1060 | pc = idetape_next_pc_storage(drive); | 1064 | pc = idetape_next_pc_storage(drive); |
1061 | ide_tape_create_rw_cmd(tape, pc, rq->current_nr_sectors, | 1065 | ide_tape_create_rw_cmd(tape, pc, rq, WRITE_6); |
1062 | (struct idetape_bh *)rq->special, | ||
1063 | WRITE_6); | ||
1064 | goto out; | 1066 | goto out; |
1065 | } | 1067 | } |
1066 | if (rq->cmd[13] & REQ_IDETAPE_PC1) { | 1068 | if (rq->cmd[13] & REQ_IDETAPE_PC1) { |
@@ -1283,6 +1285,7 @@ static int idetape_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc) | |||
1283 | rq->cmd_type = REQ_TYPE_SPECIAL; | 1285 | rq->cmd_type = REQ_TYPE_SPECIAL; |
1284 | rq->cmd[13] = REQ_IDETAPE_PC1; | 1286 | rq->cmd[13] = REQ_IDETAPE_PC1; |
1285 | rq->buffer = (char *)pc; | 1287 | rq->buffer = (char *)pc; |
1288 | memcpy(rq->cmd, pc->c, 12); | ||
1286 | error = blk_execute_rq(drive->queue, tape->disk, rq, 0); | 1289 | error = blk_execute_rq(drive->queue, tape->disk, rq, 0); |
1287 | blk_put_request(rq); | 1290 | blk_put_request(rq); |
1288 | return error; | 1291 | return error; |