aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@gmail.com>2008-07-15 15:22:03 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-15 15:22:03 -0400
commitcd2abbfec84f43db740483daf4ea528d49d8858f (patch)
treeac23e0356ae3bd5ac6a4bbe91be8786b9c4de369
parent646c0cb6c430f8d3ad3769dd1518fe664ff0ce27 (diff)
ide-tape: unify idetape_create_read/write_cmd
A straightforward one. There should be no functional change resulting from this change. [bart: minor fixups] Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-tape.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 0afa109ec99a..6e1233bdf3a0 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -952,40 +952,29 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
952 return ide_stopped; 952 return ide_stopped;
953} 953}
954 954
955static void idetape_create_read_cmd(idetape_tape_t *tape, 955static void ide_tape_create_rw_cmd(idetape_tape_t *tape,
956 struct ide_atapi_pc *pc, 956 struct ide_atapi_pc *pc, unsigned int length,
957 unsigned int length, struct idetape_bh *bh) 957 struct idetape_bh *bh, u8 opcode)
958{ 958{
959 idetape_init_pc(pc); 959 idetape_init_pc(pc);
960 pc->c[0] = READ_6;
961 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); 960 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
962 pc->c[1] = 1; 961 pc->c[1] = 1;
963 pc->bh = bh; 962 pc->bh = bh;
964 atomic_set(&bh->b_count, 0);
965 pc->buf = NULL; 963 pc->buf = NULL;
966 pc->buf_size = length * tape->blk_size; 964 pc->buf_size = length * tape->blk_size;
967 pc->req_xfer = pc->buf_size; 965 pc->req_xfer = pc->buf_size;
968 if (pc->req_xfer == tape->buffer_size) 966 if (pc->req_xfer == tape->buffer_size)
969 pc->flags |= PC_FLAG_DMA_OK; 967 pc->flags |= PC_FLAG_DMA_OK;
970}
971 968
972static void idetape_create_write_cmd(idetape_tape_t *tape, 969 if (opcode == READ_6) {
973 struct ide_atapi_pc *pc, 970 pc->c[0] = READ_6;
974 unsigned int length, struct idetape_bh *bh) 971 atomic_set(&bh->b_count, 0);
975{ 972 } else if (opcode == WRITE_6) {
976 idetape_init_pc(pc); 973 pc->c[0] = WRITE_6;
977 pc->c[0] = WRITE_6; 974 pc->flags |= PC_FLAG_WRITING;
978 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); 975 pc->b_data = bh->b_data;
979 pc->c[1] = 1; 976 pc->b_count = atomic_read(&bh->b_count);
980 pc->flags |= PC_FLAG_WRITING; 977 }
981 pc->bh = bh;
982 pc->b_data = bh->b_data;
983 pc->b_count = atomic_read(&bh->b_count);
984 pc->buf = NULL;
985 pc->buf_size = length * tape->blk_size;
986 pc->req_xfer = pc->buf_size;
987 if (pc->req_xfer == tape->buffer_size)
988 pc->flags |= PC_FLAG_DMA_OK;
989} 978}
990 979
991static ide_startstop_t idetape_do_request(ide_drive_t *drive, 980static ide_startstop_t idetape_do_request(ide_drive_t *drive,
@@ -1062,14 +1051,16 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
1062 } 1051 }
1063 if (rq->cmd[0] & REQ_IDETAPE_READ) { 1052 if (rq->cmd[0] & REQ_IDETAPE_READ) {
1064 pc = idetape_next_pc_storage(drive); 1053 pc = idetape_next_pc_storage(drive);
1065 idetape_create_read_cmd(tape, pc, rq->current_nr_sectors, 1054 ide_tape_create_rw_cmd(tape, pc, rq->current_nr_sectors,
1066 (struct idetape_bh *)rq->special); 1055 (struct idetape_bh *)rq->special,
1056 READ_6);
1067 goto out; 1057 goto out;
1068 } 1058 }
1069 if (rq->cmd[0] & REQ_IDETAPE_WRITE) { 1059 if (rq->cmd[0] & REQ_IDETAPE_WRITE) {
1070 pc = idetape_next_pc_storage(drive); 1060 pc = idetape_next_pc_storage(drive);
1071 idetape_create_write_cmd(tape, pc, rq->current_nr_sectors, 1061 ide_tape_create_rw_cmd(tape, pc, rq->current_nr_sectors,
1072 (struct idetape_bh *)rq->special); 1062 (struct idetape_bh *)rq->special,
1063 WRITE_6);
1073 goto out; 1064 goto out;
1074 } 1065 }
1075 if (rq->cmd[0] & REQ_IDETAPE_PC1) { 1066 if (rq->cmd[0] & REQ_IDETAPE_PC1) {