diff options
| -rw-r--r-- | drivers/ide/ide-atapi.c | 11 | ||||
| -rw-r--r-- | drivers/ide/ide-floppy.c | 6 | ||||
| -rw-r--r-- | drivers/ide/ide-tape.c | 10 | ||||
| -rw-r--r-- | include/linux/ide.h | 1 |
4 files changed, 14 insertions, 14 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 58411591edf3..608c5bade929 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
| @@ -162,6 +162,17 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, | |||
| 162 | } | 162 | } |
| 163 | EXPORT_SYMBOL_GPL(ide_queue_pc_tail); | 163 | EXPORT_SYMBOL_GPL(ide_queue_pc_tail); |
| 164 | 164 | ||
| 165 | int ide_do_test_unit_ready(ide_drive_t *drive, struct gendisk *disk) | ||
| 166 | { | ||
| 167 | struct ide_atapi_pc pc; | ||
| 168 | |||
| 169 | ide_init_pc(&pc); | ||
| 170 | pc.c[0] = TEST_UNIT_READY; | ||
| 171 | |||
| 172 | return ide_queue_pc_tail(drive, disk, &pc); | ||
| 173 | } | ||
| 174 | EXPORT_SYMBOL_GPL(ide_do_test_unit_ready); | ||
| 175 | |||
| 165 | int ide_do_start_stop(ide_drive_t *drive, struct gendisk *disk, int start) | 176 | int ide_do_start_stop(ide_drive_t *drive, struct gendisk *disk, int start) |
| 166 | { | 177 | { |
| 167 | struct ide_atapi_pc pc; | 178 | struct ide_atapi_pc pc; |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index b221a456e535..4d7e9ef82425 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
| @@ -773,7 +773,6 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
| 773 | struct gendisk *disk = inode->i_bdev->bd_disk; | 773 | struct gendisk *disk = inode->i_bdev->bd_disk; |
| 774 | struct ide_floppy_obj *floppy; | 774 | struct ide_floppy_obj *floppy; |
| 775 | ide_drive_t *drive; | 775 | ide_drive_t *drive; |
| 776 | struct ide_atapi_pc pc; | ||
| 777 | int ret = 0; | 776 | int ret = 0; |
| 778 | 777 | ||
| 779 | debug_log("Reached %s\n", __func__); | 778 | debug_log("Reached %s\n", __func__); |
| @@ -790,10 +789,7 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
| 790 | drive->atapi_flags &= ~IDE_AFLAG_FORMAT_IN_PROGRESS; | 789 | drive->atapi_flags &= ~IDE_AFLAG_FORMAT_IN_PROGRESS; |
| 791 | /* Just in case */ | 790 | /* Just in case */ |
| 792 | 791 | ||
| 793 | ide_init_pc(&pc); | 792 | if (ide_do_test_unit_ready(drive, disk)) |
| 794 | pc.c[0] = GPCMD_TEST_UNIT_READY; | ||
| 795 | |||
| 796 | if (ide_queue_pc_tail(drive, disk, &pc)) | ||
| 797 | ide_do_start_stop(drive, disk, 1); | 793 | ide_do_start_stop(drive, disk, 1); |
| 798 | 794 | ||
| 799 | if (ide_floppy_get_capacity(drive) | 795 | if (ide_floppy_get_capacity(drive) |
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)) { |
diff --git a/include/linux/ide.h b/include/linux/ide.h index be79122b9431..55098eed3b21 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
| @@ -1142,6 +1142,7 @@ void ide_queue_pc_head(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *, | |||
| 1142 | struct request *); | 1142 | struct request *); |
| 1143 | int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *); | 1143 | int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *); |
| 1144 | 1144 | ||
| 1145 | int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *); | ||
| 1145 | int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); | 1146 | int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); |
| 1146 | int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); | 1147 | int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); |
| 1147 | 1148 | ||
