aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:31 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:31 -0400
commit2b9efba48283f34083df6bc53f6752fba4e4d409 (patch)
tree215d86f1934c896f8ec609ab033b69bf5b99e217 /drivers/ide/ide-tape.c
parentb14c72127fbe8f97e49de7437520175673f7306a (diff)
ide: add pointer to the current packet command to ide_drive_t
* Add pointer to the current packet command (struct ide_atapi_pc *pc) to ide_drive_t and use it instead of the pointer in struct ide_*_obj. * Use drive->pc in ide_{issue,transfer}_pc() and ide_pc_intr() instead of 'pc' argument. 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.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 70b499a617d8..5b2ac04d9be9 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -172,15 +172,11 @@ typedef struct ide_tape_obj {
172 struct kref kref; 172 struct kref kref;
173 173
174 /* 174 /*
175 * pc points to the current processed packet command.
176 *
177 * failed_pc points to the last failed packet command, or contains 175 * failed_pc points to the last failed packet command, or contains
178 * NULL if we do not need to retry any packet command. This is 176 * NULL if we do not need to retry any packet command. This is
179 * required since an additional packet command is needed before the 177 * required since an additional packet command is needed before the
180 * retry, to get detailed information on what went wrong. 178 * retry, to get detailed information on what went wrong.
181 */ 179 */
182 /* Current packet command */
183 struct ide_atapi_pc *pc;
184 /* Last failed packet command */ 180 /* Last failed packet command */
185 struct ide_atapi_pc *failed_pc; 181 struct ide_atapi_pc *failed_pc;
186 /* used by REQ_IDETAPE_{READ,WRITE} requests */ 182 /* used by REQ_IDETAPE_{READ,WRITE} requests */
@@ -527,7 +523,7 @@ static void ide_tape_handle_dsc(ide_drive_t *);
527static void ide_tape_callback(ide_drive_t *drive, int dsc) 523static void ide_tape_callback(ide_drive_t *drive, int dsc)
528{ 524{
529 idetape_tape_t *tape = drive->driver_data; 525 idetape_tape_t *tape = drive->driver_data;
530 struct ide_atapi_pc *pc = tape->pc; 526 struct ide_atapi_pc *pc = drive->pc;
531 int uptodate = pc->error ? 0 : 1; 527 int uptodate = pc->error ? 0 : 1;
532 528
533 debug_log(DBG_PROCS, "Enter %s\n", __func__); 529 debug_log(DBG_PROCS, "Enter %s\n", __func__);
@@ -563,7 +559,7 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc)
563 if (pc->error) 559 if (pc->error)
564 uptodate = pc->error; 560 uptodate = pc->error;
565 } else if (pc->c[0] == READ_POSITION && uptodate) { 561 } else if (pc->c[0] == READ_POSITION && uptodate) {
566 u8 *readpos = tape->pc->buf; 562 u8 *readpos = pc->buf;
567 563
568 debug_log(DBG_SENSE, "BOP - %s\n", 564 debug_log(DBG_SENSE, "BOP - %s\n",
569 (readpos[0] & 0x80) ? "Yes" : "No"); 565 (readpos[0] & 0x80) ? "Yes" : "No");
@@ -659,9 +655,7 @@ static int ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
659 */ 655 */
660static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) 656static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
661{ 657{
662 idetape_tape_t *tape = drive->driver_data; 658 return ide_pc_intr(drive, idetape_pc_intr, WAIT_TAPE_CMD,
663
664 return ide_pc_intr(drive, tape->pc, idetape_pc_intr, WAIT_TAPE_CMD,
665 NULL, idetape_update_buffers, idetape_retry_pc, 659 NULL, idetape_update_buffers, idetape_retry_pc,
666 ide_tape_io_buffers); 660 ide_tape_io_buffers);
667} 661}
@@ -669,7 +663,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
669/* 663/*
670 * Packet Command Interface 664 * Packet Command Interface
671 * 665 *
672 * The current Packet Command is available in tape->pc, and will not change 666 * The current Packet Command is available in drive->pc, and will not change
673 * until we finish handling it. Each packet command is associated with a 667 * until we finish handling it. Each packet command is associated with a
674 * callback function that will be called when the command is finished. 668 * callback function that will be called when the command is finished.
675 * 669 *
@@ -704,10 +698,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
704 */ 698 */
705static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) 699static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
706{ 700{
707 idetape_tape_t *tape = drive->driver_data; 701 return ide_transfer_pc(drive, idetape_pc_intr, WAIT_TAPE_CMD, NULL);
708
709 return ide_transfer_pc(drive, tape->pc, idetape_pc_intr,
710 WAIT_TAPE_CMD, NULL);
711} 702}
712 703
713static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, 704static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
@@ -715,7 +706,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
715{ 706{
716 idetape_tape_t *tape = drive->driver_data; 707 idetape_tape_t *tape = drive->driver_data;
717 708
718 if (tape->pc->c[0] == REQUEST_SENSE && 709 if (drive->pc->c[0] == REQUEST_SENSE &&
719 pc->c[0] == REQUEST_SENSE) { 710 pc->c[0] == REQUEST_SENSE) {
720 printk(KERN_ERR "ide-tape: possible ide-tape.c bug - " 711 printk(KERN_ERR "ide-tape: possible ide-tape.c bug - "
721 "Two request sense in serial were issued\n"); 712 "Two request sense in serial were issued\n");
@@ -723,8 +714,9 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
723 714
724 if (tape->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) 715 if (tape->failed_pc == NULL && pc->c[0] != REQUEST_SENSE)
725 tape->failed_pc = pc; 716 tape->failed_pc = pc;
717
726 /* Set the current packet command */ 718 /* Set the current packet command */
727 tape->pc = pc; 719 drive->pc = pc;
728 720
729 if (pc->retries > IDETAPE_MAX_PC_RETRIES || 721 if (pc->retries > IDETAPE_MAX_PC_RETRIES ||
730 (pc->flags & PC_FLAG_ABORT)) { 722 (pc->flags & PC_FLAG_ABORT)) {
@@ -755,8 +747,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
755 747
756 pc->retries++; 748 pc->retries++;
757 749
758 return ide_issue_pc(drive, pc, idetape_transfer_pc, 750 return ide_issue_pc(drive, idetape_transfer_pc, WAIT_TAPE_CMD, NULL);
759 WAIT_TAPE_CMD, NULL);
760} 751}
761 752
762/* A mode sense command is used to "sense" tape parameters. */ 753/* A mode sense command is used to "sense" tape parameters. */
@@ -790,7 +781,7 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
790{ 781{
791 ide_hwif_t *hwif = drive->hwif; 782 ide_hwif_t *hwif = drive->hwif;
792 idetape_tape_t *tape = drive->driver_data; 783 idetape_tape_t *tape = drive->driver_data;
793 struct ide_atapi_pc *pc = tape->pc; 784 struct ide_atapi_pc *pc = drive->pc;
794 u8 stat; 785 u8 stat;
795 786
796 stat = hwif->tp_ops->read_status(hwif); 787 stat = hwif->tp_ops->read_status(hwif);
@@ -867,7 +858,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
867 } 858 }
868 859
869 /* Retry a failed packet command */ 860 /* Retry a failed packet command */
870 if (tape->failed_pc && tape->pc->c[0] == REQUEST_SENSE) { 861 if (tape->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {
871 pc = tape->failed_pc; 862 pc = tape->failed_pc;
872 goto out; 863 goto out;
873 } 864 }