aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r--drivers/ide/ide-tape.c29
1 files changed, 10 insertions, 19 deletions
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