diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:36 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:36 -0400 |
commit | 2e8a6f89de69d149bde135c2dc89daa9127984a9 (patch) | |
tree | ee8e3770febdc8064fdbabe26c9dce5f5c70366d /drivers/ide/ide-tape.c | |
parent | 394a4c2101f43bfb5fea7b5d1f5789a14ac018d7 (diff) |
ide-{floppy,tape}: remove packet command stack
* Add 'struct ide_atapi_pc queued_pc' to struct ide_{floppy,tape}_obj
and switch ide*_do_request() to use it (there can be only one active
request for a given device).
* Add 'struct ide_atapi_pc request_sense_pc' to struct ide_*_obj
and switch ide*_retry_pc() to use it.
* Remove needless {floppy,tape}->pc assignment from ide*_setup().
* Remove no longer needed ide*_next_pc_storage(), pc_stack[],
rq_stack_index, IDE*_PC_STACK and DBG_PC_STACK.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.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 | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index dd3533505e3b..ba05e03f482b 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -56,8 +56,6 @@ enum { | |||
56 | DBG_CHRDEV = (1 << 2), | 56 | DBG_CHRDEV = (1 << 2), |
57 | /* all remaining procedures */ | 57 | /* all remaining procedures */ |
58 | DBG_PROCS = (1 << 3), | 58 | DBG_PROCS = (1 << 3), |
59 | /* buffer alloc info (pc_stack) */ | ||
60 | DBG_PC_STACK = (1 << 4), | ||
61 | }; | 59 | }; |
62 | 60 | ||
63 | /* define to see debug info */ | 61 | /* define to see debug info */ |
@@ -89,13 +87,6 @@ enum { | |||
89 | #define IDETAPE_PC_BUFFER_SIZE 256 | 87 | #define IDETAPE_PC_BUFFER_SIZE 256 |
90 | 88 | ||
91 | /* | 89 | /* |
92 | * In various places in the driver, we need to allocate storage for packet | ||
93 | * commands, which will remain valid while we leave the driver to wait for | ||
94 | * an interrupt or a timeout event. | ||
95 | */ | ||
96 | #define IDETAPE_PC_STACK (10 + IDETAPE_MAX_PC_RETRIES) | ||
97 | |||
98 | /* | ||
99 | * Some drives (for example, Seagate STT3401A Travan) require a very long | 90 | * Some drives (for example, Seagate STT3401A Travan) require a very long |
100 | * timeout, because they don't return an interrupt or clear their busy bit | 91 | * timeout, because they don't return an interrupt or clear their busy bit |
101 | * until after the command completes (even retension commands). | 92 | * until after the command completes (even retension commands). |
@@ -208,13 +199,6 @@ typedef struct ide_tape_obj { | |||
208 | struct kref kref; | 199 | struct kref kref; |
209 | 200 | ||
210 | /* | 201 | /* |
211 | * Since a typical character device operation requires more | ||
212 | * than one packet command, we provide here enough memory | ||
213 | * for the maximum of interconnected packet commands. | ||
214 | * The packet commands are stored in the circular array pc_stack. | ||
215 | * pc_stack_index points to the last used entry, and warps around | ||
216 | * to the start when we get to the last array entry. | ||
217 | * | ||
218 | * pc points to the current processed packet command. | 202 | * pc points to the current processed packet command. |
219 | * | 203 | * |
220 | * failed_pc points to the last failed packet command, or contains | 204 | * failed_pc points to the last failed packet command, or contains |
@@ -226,11 +210,10 @@ typedef struct ide_tape_obj { | |||
226 | struct ide_atapi_pc *pc; | 210 | struct ide_atapi_pc *pc; |
227 | /* Last failed packet command */ | 211 | /* Last failed packet command */ |
228 | struct ide_atapi_pc *failed_pc; | 212 | struct ide_atapi_pc *failed_pc; |
229 | /* Packet command stack */ | 213 | /* used by REQ_IDETAPE_{READ,WRITE} requests */ |
230 | struct ide_atapi_pc pc_stack[IDETAPE_PC_STACK]; | 214 | struct ide_atapi_pc queued_pc; |
231 | /* Next free packet command storage space */ | ||
232 | int pc_stack_index; | ||
233 | 215 | ||
216 | struct ide_atapi_pc request_sense_pc; | ||
234 | struct request request_sense_rq; | 217 | struct request request_sense_rq; |
235 | 218 | ||
236 | /* | 219 | /* |
@@ -452,23 +435,6 @@ static void idetape_update_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc) | |||
452 | } | 435 | } |
453 | 436 | ||
454 | /* | 437 | /* |
455 | * idetape_next_pc_storage returns a pointer to a place in which we can | ||
456 | * safely store a packet command, even though we intend to leave the | ||
457 | * driver. A storage space for a maximum of IDETAPE_PC_STACK packet | ||
458 | * commands is allocated at initialization time. | ||
459 | */ | ||
460 | static struct ide_atapi_pc *idetape_next_pc_storage(ide_drive_t *drive) | ||
461 | { | ||
462 | idetape_tape_t *tape = drive->driver_data; | ||
463 | |||
464 | debug_log(DBG_PC_STACK, "pc_stack_index=%d\n", tape->pc_stack_index); | ||
465 | |||
466 | if (tape->pc_stack_index == IDETAPE_PC_STACK) | ||
467 | tape->pc_stack_index = 0; | ||
468 | return (&tape->pc_stack[tape->pc_stack_index++]); | ||
469 | } | ||
470 | |||
471 | /* | ||
472 | * called on each failed packet command retry to analyze the request sense. We | 438 | * called on each failed packet command retry to analyze the request sense. We |
473 | * currently do not utilize this information. | 439 | * currently do not utilize this information. |
474 | */ | 440 | */ |
@@ -693,10 +659,9 @@ static void idetape_retry_pc(ide_drive_t *drive) | |||
693 | { | 659 | { |
694 | struct ide_tape_obj *tape = drive->driver_data; | 660 | struct ide_tape_obj *tape = drive->driver_data; |
695 | struct request *rq = &tape->request_sense_rq; | 661 | struct request *rq = &tape->request_sense_rq; |
696 | struct ide_atapi_pc *pc; | 662 | struct ide_atapi_pc *pc = &tape->request_sense_pc; |
697 | 663 | ||
698 | (void)ide_read_error(drive); | 664 | (void)ide_read_error(drive); |
699 | pc = idetape_next_pc_storage(drive); | ||
700 | idetape_create_request_sense_cmd(pc); | 665 | idetape_create_request_sense_cmd(pc); |
701 | set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); | 666 | set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); |
702 | idetape_queue_pc_head(drive, pc, rq); | 667 | idetape_queue_pc_head(drive, pc, rq); |
@@ -1006,12 +971,12 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
1006 | return ide_stopped; | 971 | return ide_stopped; |
1007 | } | 972 | } |
1008 | if (rq->cmd[13] & REQ_IDETAPE_READ) { | 973 | if (rq->cmd[13] & REQ_IDETAPE_READ) { |
1009 | pc = idetape_next_pc_storage(drive); | 974 | pc = &tape->queued_pc; |
1010 | ide_tape_create_rw_cmd(tape, pc, rq, READ_6); | 975 | ide_tape_create_rw_cmd(tape, pc, rq, READ_6); |
1011 | goto out; | 976 | goto out; |
1012 | } | 977 | } |
1013 | if (rq->cmd[13] & REQ_IDETAPE_WRITE) { | 978 | if (rq->cmd[13] & REQ_IDETAPE_WRITE) { |
1014 | pc = idetape_next_pc_storage(drive); | 979 | pc = &tape->queued_pc; |
1015 | ide_tape_create_rw_cmd(tape, pc, rq, WRITE_6); | 980 | ide_tape_create_rw_cmd(tape, pc, rq, WRITE_6); |
1016 | goto out; | 981 | goto out; |
1017 | } | 982 | } |
@@ -2412,7 +2377,6 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
2412 | tape->name[1] = 't'; | 2377 | tape->name[1] = 't'; |
2413 | tape->name[2] = '0' + minor; | 2378 | tape->name[2] = '0' + minor; |
2414 | tape->chrdev_dir = IDETAPE_DIR_NONE; | 2379 | tape->chrdev_dir = IDETAPE_DIR_NONE; |
2415 | tape->pc = tape->pc_stack; | ||
2416 | 2380 | ||
2417 | *((u16 *)&gcw) = drive->id[ATA_ID_CONFIG]; | 2381 | *((u16 *)&gcw) = drive->id[ATA_ID_CONFIG]; |
2418 | 2382 | ||