aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-floppy.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:36 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:36 -0400
commit2e8a6f89de69d149bde135c2dc89daa9127984a9 (patch)
treeee8e3770febdc8064fdbabe26c9dce5f5c70366d /drivers/ide/ide-floppy.c
parent394a4c2101f43bfb5fea7b5d1f5789a14ac018d7 (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-floppy.c')
-rw-r--r--drivers/ide/ide-floppy.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 41bb61037da2..58cd6e6c687d 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -75,13 +75,6 @@
75 */ 75 */
76#define IDEFLOPPY_PC_BUFFER_SIZE 256 76#define IDEFLOPPY_PC_BUFFER_SIZE 256
77 77
78/*
79 * In various places in the driver, we need to allocate storage for packet
80 * commands, which will remain valid while we leave the driver to wait for
81 * an interrupt or a timeout event.
82 */
83#define IDEFLOPPY_PC_STACK (10 + IDEFLOPPY_MAX_PC_RETRIES)
84
85/* format capacities descriptor codes */ 78/* format capacities descriptor codes */
86#define CAPACITY_INVALID 0x00 79#define CAPACITY_INVALID 0x00
87#define CAPACITY_UNFORMATTED 0x01 80#define CAPACITY_UNFORMATTED 0x01
@@ -104,11 +97,10 @@ typedef struct ide_floppy_obj {
104 struct ide_atapi_pc *pc; 97 struct ide_atapi_pc *pc;
105 /* Last failed packet command */ 98 /* Last failed packet command */
106 struct ide_atapi_pc *failed_pc; 99 struct ide_atapi_pc *failed_pc;
107 /* Packet command stack */ 100 /* used for blk_{fs,pc}_request() requests */
108 struct ide_atapi_pc pc_stack[IDEFLOPPY_PC_STACK]; 101 struct ide_atapi_pc queued_pc;
109 /* Next free packet command storage space */
110 int pc_stack_index;
111 102
103 struct ide_atapi_pc request_sense_pc;
112 struct request request_sense_rq; 104 struct request request_sense_rq;
113 105
114 /* Last error information */ 106 /* Last error information */
@@ -296,15 +288,6 @@ static void idefloppy_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc,
296 ide_do_drive_cmd(drive, rq); 288 ide_do_drive_cmd(drive, rq);
297} 289}
298 290
299static struct ide_atapi_pc *idefloppy_next_pc_storage(ide_drive_t *drive)
300{
301 idefloppy_floppy_t *floppy = drive->driver_data;
302
303 if (floppy->pc_stack_index == IDEFLOPPY_PC_STACK)
304 floppy->pc_stack_index = 0;
305 return (&floppy->pc_stack[floppy->pc_stack_index++]);
306}
307
308static void ide_floppy_callback(ide_drive_t *drive) 291static void ide_floppy_callback(ide_drive_t *drive)
309{ 292{
310 idefloppy_floppy_t *floppy = drive->driver_data; 293 idefloppy_floppy_t *floppy = drive->driver_data;
@@ -365,10 +348,9 @@ static void idefloppy_retry_pc(ide_drive_t *drive)
365{ 348{
366 struct ide_floppy_obj *floppy = drive->driver_data; 349 struct ide_floppy_obj *floppy = drive->driver_data;
367 struct request *rq = &floppy->request_sense_rq; 350 struct request *rq = &floppy->request_sense_rq;
368 struct ide_atapi_pc *pc; 351 struct ide_atapi_pc *pc = &floppy->request_sense_pc;
369 352
370 (void)ide_read_error(drive); 353 (void)ide_read_error(drive);
371 pc = idefloppy_next_pc_storage(drive);
372 idefloppy_create_request_sense_cmd(pc); 354 idefloppy_create_request_sense_cmd(pc);
373 idefloppy_queue_pc_head(drive, pc, rq); 355 idefloppy_queue_pc_head(drive, pc, rq);
374} 356}
@@ -629,12 +611,12 @@ static ide_startstop_t idefloppy_do_request(ide_drive_t *drive,
629 idefloppy_end_request(drive, 0, 0); 611 idefloppy_end_request(drive, 0, 0);
630 return ide_stopped; 612 return ide_stopped;
631 } 613 }
632 pc = idefloppy_next_pc_storage(drive); 614 pc = &floppy->queued_pc;
633 idefloppy_create_rw_cmd(floppy, pc, rq, block); 615 idefloppy_create_rw_cmd(floppy, pc, rq, block);
634 } else if (blk_special_request(rq)) { 616 } else if (blk_special_request(rq)) {
635 pc = (struct ide_atapi_pc *) rq->buffer; 617 pc = (struct ide_atapi_pc *) rq->buffer;
636 } else if (blk_pc_request(rq)) { 618 } else if (blk_pc_request(rq)) {
637 pc = idefloppy_next_pc_storage(drive); 619 pc = &floppy->queued_pc;
638 idefloppy_blockpc_cmd(floppy, pc, rq); 620 idefloppy_blockpc_cmd(floppy, pc, rq);
639 } else { 621 } else {
640 blk_dump_rq_flags(rq, 622 blk_dump_rq_flags(rq,
@@ -1010,7 +992,7 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
1010 u8 gcw[2]; 992 u8 gcw[2];
1011 993
1012 *((u16 *)&gcw) = id[ATA_ID_CONFIG]; 994 *((u16 *)&gcw) = id[ATA_ID_CONFIG];
1013 floppy->pc = floppy->pc_stack; 995
1014 drive->pc_callback = ide_floppy_callback; 996 drive->pc_callback = ide_floppy_callback;
1015 997
1016 if (((gcw[0] & 0x60) >> 5) == 1) 998 if (((gcw[0] & 0x60) >> 5) == 1)