diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:39 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:39 -0400 |
commit | de699ad595fb45022d1b049ed91ffd06fdd16c13 (patch) | |
tree | 9fc467c912faafb4d1bd5e16de5fbf537ef2c2f6 /drivers/ide/ide-tape.c | |
parent | 0c8a6c7aead1d3be85ce53e3aaacd52e38ede03e (diff) |
ide: add ide_do_test_unit_ready() helper
* Add ide_do_test_unit_ready() helper and convert ide-{floppy,tape}.c
to use it.
* Remove no longer used idetape_create_test_unit_ready_cmd().
There should be no functional changes caused by this patch.
Acked-by: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.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 | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 5204bef4a21c..737dd7db6bb7 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -1119,25 +1119,17 @@ static void idetape_create_write_filemark_cmd(ide_drive_t *drive, | |||
1119 | pc->flags |= PC_FLAG_WAIT_FOR_DSC; | 1119 | pc->flags |= PC_FLAG_WAIT_FOR_DSC; |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | static void idetape_create_test_unit_ready_cmd(struct ide_atapi_pc *pc) | ||
1123 | { | ||
1124 | ide_init_pc(pc); | ||
1125 | pc->c[0] = TEST_UNIT_READY; | ||
1126 | } | ||
1127 | |||
1128 | static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) | 1122 | static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) |
1129 | { | 1123 | { |
1130 | idetape_tape_t *tape = drive->driver_data; | 1124 | idetape_tape_t *tape = drive->driver_data; |
1131 | struct gendisk *disk = tape->disk; | 1125 | struct gendisk *disk = tape->disk; |
1132 | struct ide_atapi_pc pc; | ||
1133 | int load_attempted = 0; | 1126 | int load_attempted = 0; |
1134 | 1127 | ||
1135 | /* Wait for the tape to become ready */ | 1128 | /* Wait for the tape to become ready */ |
1136 | set_bit(IDE_AFLAG_MEDIUM_PRESENT, &drive->atapi_flags); | 1129 | set_bit(IDE_AFLAG_MEDIUM_PRESENT, &drive->atapi_flags); |
1137 | timeout += jiffies; | 1130 | timeout += jiffies; |
1138 | while (time_before(jiffies, timeout)) { | 1131 | while (time_before(jiffies, timeout)) { |
1139 | idetape_create_test_unit_ready_cmd(&pc); | 1132 | if (ide_do_test_unit_ready(drive, disk) == 0) |
1140 | if (!ide_queue_pc_tail(drive, disk, &pc)) | ||
1141 | return 0; | 1133 | return 0; |
1142 | if ((tape->sense_key == 2 && tape->asc == 4 && tape->ascq == 2) | 1134 | if ((tape->sense_key == 2 && tape->asc == 4 && tape->ascq == 2) |
1143 | || (tape->asc == 0x3A)) { | 1135 | || (tape->asc == 0x3A)) { |