aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-floppy.c21
-rw-r--r--drivers/ide/ide-gd.h2
-rw-r--r--drivers/ide/ide-tape.c29
-rw-r--r--include/linux/ide.h3
4 files changed, 23 insertions, 32 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 6dda0fba017b..f9ad4b3021ee 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -70,7 +70,6 @@
70 */ 70 */
71static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) 71static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
72{ 72{
73 struct ide_disk_obj *floppy = drive->driver_data;
74 struct request *rq = drive->hwif->rq; 73 struct request *rq = drive->hwif->rq;
75 int error; 74 int error;
76 75
@@ -90,7 +89,7 @@ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
90 } 89 }
91 90
92 if (error) 91 if (error)
93 floppy->failed_pc = NULL; 92 drive->failed_pc = NULL;
94 93
95 if (!blk_special_request(rq)) { 94 if (!blk_special_request(rq)) {
96 /* our real local end request function */ 95 /* our real local end request function */
@@ -121,8 +120,8 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
121 120
122 ide_debug_log(IDE_DBG_FUNC, "enter"); 121 ide_debug_log(IDE_DBG_FUNC, "enter");
123 122
124 if (floppy->failed_pc == pc) 123 if (drive->failed_pc == pc)
125 floppy->failed_pc = NULL; 124 drive->failed_pc = NULL;
126 125
127 if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 || 126 if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 ||
128 (pc->rq && blk_pc_request(pc->rq))) 127 (pc->rq && blk_pc_request(pc->rq)))
@@ -137,9 +136,9 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
137 floppy->progress_indication = buf[15] & 0x80 ? 136 floppy->progress_indication = buf[15] & 0x80 ?
138 (u16)get_unaligned((u16 *)&buf[16]) : 0x10000; 137 (u16)get_unaligned((u16 *)&buf[16]) : 0x10000;
139 138
140 if (floppy->failed_pc) 139 if (drive->failed_pc)
141 ide_debug_log(IDE_DBG_PC, "pc = %x", 140 ide_debug_log(IDE_DBG_PC, "pc = %x",
142 floppy->failed_pc->c[0]); 141 drive->failed_pc->c[0]);
143 142
144 ide_debug_log(IDE_DBG_SENSE, "sense key = %x, asc = %x," 143 ide_debug_log(IDE_DBG_SENSE, "sense key = %x, asc = %x,"
145 "ascq = %x", floppy->sense_key, 144 "ascq = %x", floppy->sense_key,
@@ -173,9 +172,9 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
173{ 172{
174 struct ide_disk_obj *floppy = drive->driver_data; 173 struct ide_disk_obj *floppy = drive->driver_data;
175 174
176 if (floppy->failed_pc == NULL && 175 if (drive->failed_pc == NULL &&
177 pc->c[0] != GPCMD_REQUEST_SENSE) 176 pc->c[0] != GPCMD_REQUEST_SENSE)
178 floppy->failed_pc = pc; 177 drive->failed_pc = pc;
179 178
180 /* Set the current packet command */ 179 /* Set the current packet command */
181 drive->pc = pc; 180 drive->pc = pc;
@@ -186,7 +185,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
186 /* Giving up */ 185 /* Giving up */
187 pc->error = IDEFLOPPY_ERROR_GENERAL; 186 pc->error = IDEFLOPPY_ERROR_GENERAL;
188 187
189 floppy->failed_pc = NULL; 188 drive->failed_pc = NULL;
190 drive->pc_callback(drive, 0); 189 drive->pc_callback(drive, 0);
191 return ide_stopped; 190 return ide_stopped;
192 } 191 }
@@ -290,8 +289,8 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
290 : "dev?")); 289 : "dev?"));
291 290
292 if (rq->errors >= ERROR_MAX) { 291 if (rq->errors >= ERROR_MAX) {
293 if (floppy->failed_pc) 292 if (drive->failed_pc)
294 ide_floppy_report_error(floppy, floppy->failed_pc); 293 ide_floppy_report_error(floppy, drive->failed_pc);
295 else 294 else
296 printk(KERN_ERR PFX "%s: I/O error\n", drive->name); 295 printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
297 296
diff --git a/drivers/ide/ide-gd.h b/drivers/ide/ide-gd.h
index 70b43765327d..55970772bd04 100644
--- a/drivers/ide/ide-gd.h
+++ b/drivers/ide/ide-gd.h
@@ -20,8 +20,6 @@ struct ide_disk_obj {
20 struct device dev; 20 struct device dev;
21 unsigned int openers; /* protected by BKL for now */ 21 unsigned int openers; /* protected by BKL for now */
22 22
23 /* Last failed packet command */
24 struct ide_atapi_pc *failed_pc;
25 /* used for blk_{fs,pc}_request() requests */ 23 /* used for blk_{fs,pc}_request() requests */
26 struct ide_atapi_pc queued_pc; 24 struct ide_atapi_pc queued_pc;
27 25
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 72b4350bfeb6..d6555984ee88 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -171,14 +171,6 @@ typedef struct ide_tape_obj {
171 struct gendisk *disk; 171 struct gendisk *disk;
172 struct device dev; 172 struct device dev;
173 173
174 /*
175 * failed_pc points to the last failed packet command, or contains
176 * NULL if we do not need to retry any packet command. This is
177 * required since an additional packet command is needed before the
178 * retry, to get detailed information on what went wrong.
179 */
180 /* Last failed packet command */
181 struct ide_atapi_pc *failed_pc;
182 /* used by REQ_IDETAPE_{READ,WRITE} requests */ 174 /* used by REQ_IDETAPE_{READ,WRITE} requests */
183 struct ide_atapi_pc queued_pc; 175 struct ide_atapi_pc queued_pc;
184 176
@@ -397,7 +389,7 @@ static void idetape_update_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc)
397static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) 389static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
398{ 390{
399 idetape_tape_t *tape = drive->driver_data; 391 idetape_tape_t *tape = drive->driver_data;
400 struct ide_atapi_pc *pc = tape->failed_pc; 392 struct ide_atapi_pc *pc = drive->failed_pc;
401 393
402 tape->sense_key = sense[2] & 0xF; 394 tape->sense_key = sense[2] & 0xF;
403 tape->asc = sense[12]; 395 tape->asc = sense[12];
@@ -477,7 +469,6 @@ static void ide_tape_kfree_buffer(idetape_tape_t *tape)
477static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) 469static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
478{ 470{
479 struct request *rq = drive->hwif->rq; 471 struct request *rq = drive->hwif->rq;
480 idetape_tape_t *tape = drive->driver_data;
481 int error; 472 int error;
482 473
483 debug_log(DBG_PROCS, "Enter %s\n", __func__); 474 debug_log(DBG_PROCS, "Enter %s\n", __func__);
@@ -489,7 +480,7 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
489 } 480 }
490 rq->errors = error; 481 rq->errors = error;
491 if (error) 482 if (error)
492 tape->failed_pc = NULL; 483 drive->failed_pc = NULL;
493 484
494 if (!blk_special_request(rq)) { 485 if (!blk_special_request(rq)) {
495 ide_end_request(drive, uptodate, nr_sects); 486 ide_end_request(drive, uptodate, nr_sects);
@@ -514,8 +505,8 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc)
514 if (dsc) 505 if (dsc)
515 ide_tape_handle_dsc(drive); 506 ide_tape_handle_dsc(drive);
516 507
517 if (tape->failed_pc == pc) 508 if (drive->failed_pc == pc)
518 tape->failed_pc = NULL; 509 drive->failed_pc = NULL;
519 510
520 if (pc->c[0] == REQUEST_SENSE) { 511 if (pc->c[0] == REQUEST_SENSE) {
521 if (uptodate) 512 if (uptodate)
@@ -653,8 +644,8 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
653 "Two request sense in serial were issued\n"); 644 "Two request sense in serial were issued\n");
654 } 645 }
655 646
656 if (tape->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) 647 if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE)
657 tape->failed_pc = pc; 648 drive->failed_pc = pc;
658 649
659 /* Set the current packet command */ 650 /* Set the current packet command */
660 drive->pc = pc; 651 drive->pc = pc;
@@ -680,7 +671,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
680 /* Giving up */ 671 /* Giving up */
681 pc->error = IDETAPE_ERROR_GENERAL; 672 pc->error = IDETAPE_ERROR_GENERAL;
682 } 673 }
683 tape->failed_pc = NULL; 674 drive->failed_pc = NULL;
684 drive->pc_callback(drive, 0); 675 drive->pc_callback(drive, 0);
685 return ide_stopped; 676 return ide_stopped;
686 } 677 }
@@ -740,7 +731,7 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
740 pc->error = 0; 731 pc->error = 0;
741 } else { 732 } else {
742 pc->error = IDETAPE_ERROR_GENERAL; 733 pc->error = IDETAPE_ERROR_GENERAL;
743 tape->failed_pc = NULL; 734 drive->failed_pc = NULL;
744 } 735 }
745 drive->pc_callback(drive, 0); 736 drive->pc_callback(drive, 0);
746 return ide_stopped; 737 return ide_stopped;
@@ -799,8 +790,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
799 } 790 }
800 791
801 /* Retry a failed packet command */ 792 /* Retry a failed packet command */
802 if (tape->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { 793 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {
803 pc = tape->failed_pc; 794 pc = drive->failed_pc;
804 goto out; 795 goto out;
805 } 796 }
806 797
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 8b0ea43884c0..4a904681f3e4 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -609,6 +609,9 @@ struct ide_drive_s {
609 /* current packet command */ 609 /* current packet command */
610 struct ide_atapi_pc *pc; 610 struct ide_atapi_pc *pc;
611 611
612 /* last failed packet command */
613 struct ide_atapi_pc *failed_pc;
614
612 /* callback for packet commands */ 615 /* callback for packet commands */
613 void (*pc_callback)(struct ide_drive_s *, int); 616 void (*pc_callback)(struct ide_drive_s *, int);
614 617