diff options
| -rw-r--r-- | drivers/ide/ide-atapi.c | 23 | ||||
| -rw-r--r-- | drivers/ide/ide-floppy.c | 49 | ||||
| -rw-r--r-- | drivers/ide/ide-tape.c | 69 | ||||
| -rw-r--r-- | include/linux/ide.h | 1 |
4 files changed, 69 insertions, 73 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index da71bfce92e8..f82ddfb9a44e 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
| @@ -139,6 +139,29 @@ void ide_queue_pc_head(ide_drive_t *drive, struct gendisk *disk, | |||
| 139 | } | 139 | } |
| 140 | EXPORT_SYMBOL_GPL(ide_queue_pc_head); | 140 | EXPORT_SYMBOL_GPL(ide_queue_pc_head); |
| 141 | 141 | ||
| 142 | /* | ||
| 143 | * Add a special packet command request to the tail of the request queue, | ||
| 144 | * and wait for it to be serviced. | ||
| 145 | */ | ||
| 146 | int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, | ||
| 147 | struct ide_atapi_pc *pc) | ||
| 148 | { | ||
| 149 | struct request *rq; | ||
| 150 | int error; | ||
| 151 | |||
| 152 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | ||
| 153 | rq->cmd_type = REQ_TYPE_SPECIAL; | ||
| 154 | rq->buffer = (char *)pc; | ||
| 155 | memcpy(rq->cmd, pc->c, 12); | ||
| 156 | if (drive->media == ide_tape) | ||
| 157 | rq->cmd[13] = REQ_IDETAPE_PC1; | ||
| 158 | error = blk_execute_rq(drive->queue, disk, rq, 0); | ||
| 159 | blk_put_request(rq); | ||
| 160 | |||
| 161 | return error; | ||
| 162 | } | ||
| 163 | EXPORT_SYMBOL_GPL(ide_queue_pc_tail); | ||
| 164 | |||
| 142 | /* TODO: unify the code thus making some arguments go away */ | 165 | /* TODO: unify the code thus making some arguments go away */ |
| 143 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, | 166 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, |
| 144 | ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, | 167 | ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index ddce28e77a4e..de611c57b280 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
| @@ -554,32 +554,13 @@ static ide_startstop_t idefloppy_do_request(ide_drive_t *drive, | |||
| 554 | } | 554 | } |
| 555 | 555 | ||
| 556 | /* | 556 | /* |
| 557 | * Add a special packet command request to the tail of the request queue, | ||
| 558 | * and wait for it to be serviced. | ||
| 559 | */ | ||
| 560 | static int idefloppy_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc) | ||
| 561 | { | ||
| 562 | struct ide_floppy_obj *floppy = drive->driver_data; | ||
| 563 | struct request *rq; | ||
| 564 | int error; | ||
| 565 | |||
| 566 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | ||
| 567 | rq->buffer = (char *) pc; | ||
| 568 | rq->cmd_type = REQ_TYPE_SPECIAL; | ||
| 569 | memcpy(rq->cmd, pc->c, 12); | ||
| 570 | error = blk_execute_rq(drive->queue, floppy->disk, rq, 0); | ||
| 571 | blk_put_request(rq); | ||
| 572 | |||
| 573 | return error; | ||
| 574 | } | ||
| 575 | |||
| 576 | /* | ||
| 577 | * Look at the flexible disk page parameters. We ignore the CHS capacity | 557 | * Look at the flexible disk page parameters. We ignore the CHS capacity |
| 578 | * parameters and use the LBA parameters instead. | 558 | * parameters and use the LBA parameters instead. |
| 579 | */ | 559 | */ |
| 580 | static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive) | 560 | static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive) |
| 581 | { | 561 | { |
| 582 | idefloppy_floppy_t *floppy = drive->driver_data; | 562 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 563 | struct gendisk *disk = floppy->disk; | ||
| 583 | struct ide_atapi_pc pc; | 564 | struct ide_atapi_pc pc; |
| 584 | u8 *page; | 565 | u8 *page; |
| 585 | int capacity, lba_capacity; | 566 | int capacity, lba_capacity; |
| @@ -588,13 +569,13 @@ static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive) | |||
| 588 | 569 | ||
| 589 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE); | 570 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE); |
| 590 | 571 | ||
| 591 | if (idefloppy_queue_pc_tail(drive, &pc)) { | 572 | if (ide_queue_pc_tail(drive, disk, &pc)) { |
| 592 | printk(KERN_ERR "ide-floppy: Can't get flexible disk page" | 573 | printk(KERN_ERR "ide-floppy: Can't get flexible disk page" |
| 593 | " parameters\n"); | 574 | " parameters\n"); |
| 594 | return 1; | 575 | return 1; |
| 595 | } | 576 | } |
| 596 | floppy->wp = !!(pc.buf[3] & 0x80); | 577 | floppy->wp = !!(pc.buf[3] & 0x80); |
| 597 | set_disk_ro(floppy->disk, floppy->wp); | 578 | set_disk_ro(disk, floppy->wp); |
| 598 | page = &pc.buf[8]; | 579 | page = &pc.buf[8]; |
| 599 | 580 | ||
| 600 | transfer_rate = be16_to_cpup((__be16 *)&pc.buf[8 + 2]); | 581 | transfer_rate = be16_to_cpup((__be16 *)&pc.buf[8 + 2]); |
| @@ -638,7 +619,7 @@ static int idefloppy_get_sfrp_bit(ide_drive_t *drive) | |||
| 638 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE); | 619 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE); |
| 639 | pc.flags |= PC_FLAG_SUPPRESS_ERROR; | 620 | pc.flags |= PC_FLAG_SUPPRESS_ERROR; |
| 640 | 621 | ||
| 641 | if (idefloppy_queue_pc_tail(drive, &pc)) | 622 | if (ide_queue_pc_tail(drive, floppy->disk, &pc)) |
| 642 | return 1; | 623 | return 1; |
| 643 | 624 | ||
| 644 | floppy->srfp = pc.buf[8 + 2] & 0x40; | 625 | floppy->srfp = pc.buf[8 + 2] & 0x40; |
| @@ -652,6 +633,7 @@ static int idefloppy_get_sfrp_bit(ide_drive_t *drive) | |||
| 652 | static int ide_floppy_get_capacity(ide_drive_t *drive) | 633 | static int ide_floppy_get_capacity(ide_drive_t *drive) |
| 653 | { | 634 | { |
| 654 | idefloppy_floppy_t *floppy = drive->driver_data; | 635 | idefloppy_floppy_t *floppy = drive->driver_data; |
| 636 | struct gendisk *disk = floppy->disk; | ||
| 655 | struct ide_atapi_pc pc; | 637 | struct ide_atapi_pc pc; |
| 656 | u8 *cap_desc; | 638 | u8 *cap_desc; |
| 657 | u8 header_len, desc_cnt; | 639 | u8 header_len, desc_cnt; |
| @@ -664,7 +646,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
| 664 | set_capacity(floppy->disk, 0); | 646 | set_capacity(floppy->disk, 0); |
| 665 | 647 | ||
| 666 | idefloppy_create_read_capacity_cmd(&pc); | 648 | idefloppy_create_read_capacity_cmd(&pc); |
| 667 | if (idefloppy_queue_pc_tail(drive, &pc)) { | 649 | if (ide_queue_pc_tail(drive, disk, &pc)) { |
| 668 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); | 650 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); |
| 669 | return 1; | 651 | return 1; |
| 670 | } | 652 | } |
| @@ -739,7 +721,8 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
| 739 | if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE)) | 721 | if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE)) |
| 740 | (void) ide_floppy_get_flexible_disk_page(drive); | 722 | (void) ide_floppy_get_flexible_disk_page(drive); |
| 741 | 723 | ||
| 742 | set_capacity(floppy->disk, floppy->blocks * floppy->bs_factor); | 724 | set_capacity(disk, floppy->blocks * floppy->bs_factor); |
| 725 | |||
| 743 | return rc; | 726 | return rc; |
| 744 | } | 727 | } |
| 745 | 728 | ||
| @@ -764,6 +747,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
| 764 | 747 | ||
| 765 | static int ide_floppy_get_format_capacities(ide_drive_t *drive, int __user *arg) | 748 | static int ide_floppy_get_format_capacities(ide_drive_t *drive, int __user *arg) |
| 766 | { | 749 | { |
| 750 | struct ide_floppy_obj *floppy = drive->driver_data; | ||
| 767 | struct ide_atapi_pc pc; | 751 | struct ide_atapi_pc pc; |
| 768 | u8 header_len, desc_cnt; | 752 | u8 header_len, desc_cnt; |
| 769 | int i, blocks, length, u_array_size, u_index; | 753 | int i, blocks, length, u_array_size, u_index; |
| @@ -776,7 +760,7 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive, int __user *arg) | |||
| 776 | return -EINVAL; | 760 | return -EINVAL; |
| 777 | 761 | ||
| 778 | idefloppy_create_read_capacity_cmd(&pc); | 762 | idefloppy_create_read_capacity_cmd(&pc); |
| 779 | if (idefloppy_queue_pc_tail(drive, &pc)) { | 763 | if (ide_queue_pc_tail(drive, floppy->disk, &pc)) { |
| 780 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); | 764 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); |
| 781 | return -EIO; | 765 | return -EIO; |
| 782 | } | 766 | } |
| @@ -838,7 +822,7 @@ static int ide_floppy_get_format_progress(ide_drive_t *drive, int __user *arg) | |||
| 838 | 822 | ||
| 839 | if (floppy->srfp) { | 823 | if (floppy->srfp) { |
| 840 | idefloppy_create_request_sense_cmd(&pc); | 824 | idefloppy_create_request_sense_cmd(&pc); |
| 841 | if (idefloppy_queue_pc_tail(drive, &pc)) | 825 | if (ide_queue_pc_tail(drive, floppy->disk, &pc)) |
| 842 | return -EIO; | 826 | return -EIO; |
| 843 | 827 | ||
| 844 | if (floppy->sense_key == 2 && | 828 | if (floppy->sense_key == 2 && |
| @@ -1008,12 +992,13 @@ static ide_driver_t idefloppy_driver = { | |||
| 1008 | 992 | ||
| 1009 | static void ide_floppy_set_media_lock(ide_drive_t *drive, int on) | 993 | static void ide_floppy_set_media_lock(ide_drive_t *drive, int on) |
| 1010 | { | 994 | { |
| 995 | struct ide_floppy_obj *floppy = drive->driver_data; | ||
| 1011 | struct ide_atapi_pc pc; | 996 | struct ide_atapi_pc pc; |
| 1012 | 997 | ||
| 1013 | /* IOMEGA Clik! drives do not support lock/unlock commands */ | 998 | /* IOMEGA Clik! drives do not support lock/unlock commands */ |
| 1014 | if ((drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE) == 0) { | 999 | if ((drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE) == 0) { |
| 1015 | idefloppy_create_prevent_cmd(&pc, on); | 1000 | idefloppy_create_prevent_cmd(&pc, on); |
| 1016 | (void)idefloppy_queue_pc_tail(drive, &pc); | 1001 | (void)ide_queue_pc_tail(drive, floppy->disk, &pc); |
| 1017 | } | 1002 | } |
| 1018 | } | 1003 | } |
| 1019 | 1004 | ||
| @@ -1042,9 +1027,9 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
| 1042 | ide_init_pc(&pc); | 1027 | ide_init_pc(&pc); |
| 1043 | pc.c[0] = GPCMD_TEST_UNIT_READY; | 1028 | pc.c[0] = GPCMD_TEST_UNIT_READY; |
| 1044 | 1029 | ||
| 1045 | if (idefloppy_queue_pc_tail(drive, &pc)) { | 1030 | if (ide_queue_pc_tail(drive, disk, &pc)) { |
| 1046 | idefloppy_create_start_stop_cmd(&pc, 1); | 1031 | idefloppy_create_start_stop_cmd(&pc, 1); |
| 1047 | (void) idefloppy_queue_pc_tail(drive, &pc); | 1032 | (void)ide_queue_pc_tail(drive, disk, &pc); |
| 1048 | } | 1033 | } |
| 1049 | 1034 | ||
| 1050 | if (ide_floppy_get_capacity(drive) | 1035 | if (ide_floppy_get_capacity(drive) |
| @@ -1123,7 +1108,7 @@ static int ide_floppy_lockdoor(ide_drive_t *drive, struct ide_atapi_pc *pc, | |||
| 1123 | 1108 | ||
| 1124 | if (cmd == CDROMEJECT) { | 1109 | if (cmd == CDROMEJECT) { |
| 1125 | idefloppy_create_start_stop_cmd(pc, 2); | 1110 | idefloppy_create_start_stop_cmd(pc, 2); |
| 1126 | (void) idefloppy_queue_pc_tail(floppy->drive, pc); | 1111 | (void)ide_queue_pc_tail(drive, floppy->disk, pc); |
| 1127 | } | 1112 | } |
| 1128 | 1113 | ||
| 1129 | return 0; | 1114 | return 0; |
| @@ -1168,7 +1153,7 @@ static int ide_floppy_format_unit(ide_drive_t *drive, int __user *arg) | |||
| 1168 | (void) idefloppy_get_sfrp_bit(drive); | 1153 | (void) idefloppy_get_sfrp_bit(drive); |
| 1169 | idefloppy_create_format_unit_cmd(&pc, blocks, length, flags); | 1154 | idefloppy_create_format_unit_cmd(&pc, blocks, length, flags); |
| 1170 | 1155 | ||
| 1171 | if (idefloppy_queue_pc_tail(drive, &pc)) | 1156 | if (ide_queue_pc_tail(drive, floppy->disk, &pc)) |
| 1172 | err = -EIO; | 1157 | err = -EIO; |
| 1173 | 1158 | ||
| 1174 | out: | 1159 | out: |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 7103b98eb53a..88cb94554267 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
| @@ -1125,26 +1125,6 @@ static void idetape_create_test_unit_ready_cmd(struct ide_atapi_pc *pc) | |||
| 1125 | pc->c[0] = TEST_UNIT_READY; | 1125 | pc->c[0] = TEST_UNIT_READY; |
| 1126 | } | 1126 | } |
| 1127 | 1127 | ||
| 1128 | /* | ||
| 1129 | * We add a special packet command request to the tail of the request queue, and | ||
| 1130 | * wait for it to be serviced. | ||
| 1131 | */ | ||
| 1132 | static int idetape_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc) | ||
| 1133 | { | ||
| 1134 | struct ide_tape_obj *tape = drive->driver_data; | ||
| 1135 | struct request *rq; | ||
| 1136 | int error; | ||
| 1137 | |||
| 1138 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | ||
| 1139 | rq->cmd_type = REQ_TYPE_SPECIAL; | ||
| 1140 | rq->cmd[13] = REQ_IDETAPE_PC1; | ||
| 1141 | rq->buffer = (char *)pc; | ||
| 1142 | memcpy(rq->cmd, pc->c, 12); | ||
| 1143 | error = blk_execute_rq(drive->queue, tape->disk, rq, 0); | ||
| 1144 | blk_put_request(rq); | ||
| 1145 | return error; | ||
| 1146 | } | ||
| 1147 | |||
| 1148 | static void idetape_create_load_unload_cmd(ide_drive_t *drive, | 1128 | static void idetape_create_load_unload_cmd(ide_drive_t *drive, |
| 1149 | struct ide_atapi_pc *pc, int cmd) | 1129 | struct ide_atapi_pc *pc, int cmd) |
| 1150 | { | 1130 | { |
| @@ -1157,6 +1137,7 @@ static void idetape_create_load_unload_cmd(ide_drive_t *drive, | |||
| 1157 | static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) | 1137 | static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) |
| 1158 | { | 1138 | { |
| 1159 | idetape_tape_t *tape = drive->driver_data; | 1139 | idetape_tape_t *tape = drive->driver_data; |
| 1140 | struct gendisk *disk = tape->disk; | ||
| 1160 | struct ide_atapi_pc pc; | 1141 | struct ide_atapi_pc pc; |
| 1161 | int load_attempted = 0; | 1142 | int load_attempted = 0; |
| 1162 | 1143 | ||
| @@ -1165,7 +1146,7 @@ static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) | |||
| 1165 | timeout += jiffies; | 1146 | timeout += jiffies; |
| 1166 | while (time_before(jiffies, timeout)) { | 1147 | while (time_before(jiffies, timeout)) { |
| 1167 | idetape_create_test_unit_ready_cmd(&pc); | 1148 | idetape_create_test_unit_ready_cmd(&pc); |
| 1168 | if (!idetape_queue_pc_tail(drive, &pc)) | 1149 | if (!ide_queue_pc_tail(drive, disk, &pc)) |
| 1169 | return 0; | 1150 | return 0; |
| 1170 | if ((tape->sense_key == 2 && tape->asc == 4 && tape->ascq == 2) | 1151 | if ((tape->sense_key == 2 && tape->asc == 4 && tape->ascq == 2) |
| 1171 | || (tape->asc == 0x3A)) { | 1152 | || (tape->asc == 0x3A)) { |
| @@ -1174,7 +1155,7 @@ static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) | |||
| 1174 | return -ENOMEDIUM; | 1155 | return -ENOMEDIUM; |
| 1175 | idetape_create_load_unload_cmd(drive, &pc, | 1156 | idetape_create_load_unload_cmd(drive, &pc, |
| 1176 | IDETAPE_LU_LOAD_MASK); | 1157 | IDETAPE_LU_LOAD_MASK); |
| 1177 | idetape_queue_pc_tail(drive, &pc); | 1158 | ide_queue_pc_tail(drive, disk, &pc); |
| 1178 | load_attempted = 1; | 1159 | load_attempted = 1; |
| 1179 | /* not about to be ready */ | 1160 | /* not about to be ready */ |
| 1180 | } else if (!(tape->sense_key == 2 && tape->asc == 4 && | 1161 | } else if (!(tape->sense_key == 2 && tape->asc == 4 && |
| @@ -1187,11 +1168,12 @@ static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) | |||
| 1187 | 1168 | ||
| 1188 | static int idetape_flush_tape_buffers(ide_drive_t *drive) | 1169 | static int idetape_flush_tape_buffers(ide_drive_t *drive) |
| 1189 | { | 1170 | { |
| 1171 | struct ide_tape_obj *tape = drive->driver_data; | ||
| 1190 | struct ide_atapi_pc pc; | 1172 | struct ide_atapi_pc pc; |
| 1191 | int rc; | 1173 | int rc; |
| 1192 | 1174 | ||
| 1193 | idetape_create_write_filemark_cmd(drive, &pc, 0); | 1175 | idetape_create_write_filemark_cmd(drive, &pc, 0); |
| 1194 | rc = idetape_queue_pc_tail(drive, &pc); | 1176 | rc = ide_queue_pc_tail(drive, tape->disk, &pc); |
| 1195 | if (rc) | 1177 | if (rc) |
| 1196 | return rc; | 1178 | return rc; |
| 1197 | idetape_wait_ready(drive, 60 * 5 * HZ); | 1179 | idetape_wait_ready(drive, 60 * 5 * HZ); |
| @@ -1214,7 +1196,7 @@ static int idetape_read_position(ide_drive_t *drive) | |||
| 1214 | debug_log(DBG_PROCS, "Enter %s\n", __func__); | 1196 | debug_log(DBG_PROCS, "Enter %s\n", __func__); |
| 1215 | 1197 | ||
| 1216 | idetape_create_read_position_cmd(&pc); | 1198 | idetape_create_read_position_cmd(&pc); |
| 1217 | if (idetape_queue_pc_tail(drive, &pc)) | 1199 | if (ide_queue_pc_tail(drive, tape->disk, &pc)) |
| 1218 | return -1; | 1200 | return -1; |
| 1219 | position = tape->first_frame; | 1201 | position = tape->first_frame; |
| 1220 | return position; | 1202 | return position; |
| @@ -1249,12 +1231,13 @@ static int idetape_create_prevent_cmd(ide_drive_t *drive, | |||
| 1249 | 1231 | ||
| 1250 | static int ide_tape_set_media_lock(ide_drive_t *drive, int on) | 1232 | static int ide_tape_set_media_lock(ide_drive_t *drive, int on) |
| 1251 | { | 1233 | { |
| 1234 | struct ide_tape_obj *tape = drive->driver_data; | ||
| 1252 | struct ide_atapi_pc pc; | 1235 | struct ide_atapi_pc pc; |
| 1253 | 1236 | ||
| 1254 | if (!idetape_create_prevent_cmd(drive, &pc, on)) | 1237 | if (!idetape_create_prevent_cmd(drive, &pc, on)) |
| 1255 | return 0; | 1238 | return 0; |
| 1256 | 1239 | ||
| 1257 | return idetape_queue_pc_tail(drive, &pc); | 1240 | return ide_queue_pc_tail(drive, tape->disk, &pc); |
| 1258 | } | 1241 | } |
| 1259 | 1242 | ||
| 1260 | static void __ide_tape_discard_merge_buffer(ide_drive_t *drive) | 1243 | static void __ide_tape_discard_merge_buffer(ide_drive_t *drive) |
| @@ -1284,6 +1267,7 @@ static int idetape_position_tape(ide_drive_t *drive, unsigned int block, | |||
| 1284 | u8 partition, int skip) | 1267 | u8 partition, int skip) |
| 1285 | { | 1268 | { |
| 1286 | idetape_tape_t *tape = drive->driver_data; | 1269 | idetape_tape_t *tape = drive->driver_data; |
| 1270 | struct gendisk *disk = tape->disk; | ||
| 1287 | int retval; | 1271 | int retval; |
| 1288 | struct ide_atapi_pc pc; | 1272 | struct ide_atapi_pc pc; |
| 1289 | 1273 | ||
| @@ -1291,12 +1275,12 @@ static int idetape_position_tape(ide_drive_t *drive, unsigned int block, | |||
| 1291 | __ide_tape_discard_merge_buffer(drive); | 1275 | __ide_tape_discard_merge_buffer(drive); |
| 1292 | idetape_wait_ready(drive, 60 * 5 * HZ); | 1276 | idetape_wait_ready(drive, 60 * 5 * HZ); |
| 1293 | idetape_create_locate_cmd(drive, &pc, block, partition, skip); | 1277 | idetape_create_locate_cmd(drive, &pc, block, partition, skip); |
| 1294 | retval = idetape_queue_pc_tail(drive, &pc); | 1278 | retval = ide_queue_pc_tail(drive, disk, &pc); |
| 1295 | if (retval) | 1279 | if (retval) |
| 1296 | return (retval); | 1280 | return (retval); |
| 1297 | 1281 | ||
| 1298 | idetape_create_read_position_cmd(&pc); | 1282 | idetape_create_read_position_cmd(&pc); |
| 1299 | return (idetape_queue_pc_tail(drive, &pc)); | 1283 | return ide_queue_pc_tail(drive, disk, &pc); |
| 1300 | } | 1284 | } |
| 1301 | 1285 | ||
| 1302 | static void ide_tape_discard_merge_buffer(ide_drive_t *drive, | 1286 | static void ide_tape_discard_merge_buffer(ide_drive_t *drive, |
| @@ -1543,20 +1527,20 @@ static void idetape_pad_zeros(ide_drive_t *drive, int bcount) | |||
| 1543 | */ | 1527 | */ |
| 1544 | static int idetape_rewind_tape(ide_drive_t *drive) | 1528 | static int idetape_rewind_tape(ide_drive_t *drive) |
| 1545 | { | 1529 | { |
| 1530 | struct ide_tape_obj *tape = drive->driver_data; | ||
| 1531 | struct gendisk *disk = tape->disk; | ||
| 1546 | int retval; | 1532 | int retval; |
| 1547 | struct ide_atapi_pc pc; | 1533 | struct ide_atapi_pc pc; |
| 1548 | idetape_tape_t *tape; | ||
| 1549 | tape = drive->driver_data; | ||
| 1550 | 1534 | ||
| 1551 | debug_log(DBG_SENSE, "Enter %s\n", __func__); | 1535 | debug_log(DBG_SENSE, "Enter %s\n", __func__); |
| 1552 | 1536 | ||
| 1553 | idetape_create_rewind_cmd(drive, &pc); | 1537 | idetape_create_rewind_cmd(drive, &pc); |
| 1554 | retval = idetape_queue_pc_tail(drive, &pc); | 1538 | retval = ide_queue_pc_tail(drive, disk, &pc); |
| 1555 | if (retval) | 1539 | if (retval) |
| 1556 | return retval; | 1540 | return retval; |
| 1557 | 1541 | ||
| 1558 | idetape_create_read_position_cmd(&pc); | 1542 | idetape_create_read_position_cmd(&pc); |
| 1559 | retval = idetape_queue_pc_tail(drive, &pc); | 1543 | retval = ide_queue_pc_tail(drive, disk, &pc); |
| 1560 | if (retval) | 1544 | if (retval) |
| 1561 | return retval; | 1545 | return retval; |
| 1562 | return 0; | 1546 | return 0; |
| @@ -1599,6 +1583,7 @@ static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op, | |||
| 1599 | int mt_count) | 1583 | int mt_count) |
| 1600 | { | 1584 | { |
| 1601 | idetape_tape_t *tape = drive->driver_data; | 1585 | idetape_tape_t *tape = drive->driver_data; |
| 1586 | struct gendisk *disk = tape->disk; | ||
| 1602 | struct ide_atapi_pc pc; | 1587 | struct ide_atapi_pc pc; |
| 1603 | int retval, count = 0; | 1588 | int retval, count = 0; |
| 1604 | int sprev = !!(tape->caps[4] & 0x20); | 1589 | int sprev = !!(tape->caps[4] & 0x20); |
| @@ -1623,7 +1608,7 @@ static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op, | |||
| 1623 | case MTBSF: | 1608 | case MTBSF: |
| 1624 | idetape_create_space_cmd(&pc, mt_count - count, | 1609 | idetape_create_space_cmd(&pc, mt_count - count, |
| 1625 | IDETAPE_SPACE_OVER_FILEMARK); | 1610 | IDETAPE_SPACE_OVER_FILEMARK); |
| 1626 | return idetape_queue_pc_tail(drive, &pc); | 1611 | return ide_queue_pc_tail(drive, disk, &pc); |
| 1627 | case MTFSFM: | 1612 | case MTFSFM: |
| 1628 | case MTBSFM: | 1613 | case MTBSFM: |
| 1629 | if (!sprev) | 1614 | if (!sprev) |
| @@ -1812,11 +1797,12 @@ static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf, | |||
| 1812 | 1797 | ||
| 1813 | static int idetape_write_filemark(ide_drive_t *drive) | 1798 | static int idetape_write_filemark(ide_drive_t *drive) |
| 1814 | { | 1799 | { |
| 1800 | struct ide_tape_obj *tape = drive->driver_data; | ||
| 1815 | struct ide_atapi_pc pc; | 1801 | struct ide_atapi_pc pc; |
| 1816 | 1802 | ||
| 1817 | /* Write a filemark */ | 1803 | /* Write a filemark */ |
| 1818 | idetape_create_write_filemark_cmd(drive, &pc, 1); | 1804 | idetape_create_write_filemark_cmd(drive, &pc, 1); |
| 1819 | if (idetape_queue_pc_tail(drive, &pc)) { | 1805 | if (ide_queue_pc_tail(drive, tape->disk, &pc)) { |
| 1820 | printk(KERN_ERR "ide-tape: Couldn't write a filemark\n"); | 1806 | printk(KERN_ERR "ide-tape: Couldn't write a filemark\n"); |
| 1821 | return -EIO; | 1807 | return -EIO; |
| 1822 | } | 1808 | } |
| @@ -1839,6 +1825,7 @@ static int idetape_write_filemark(ide_drive_t *drive) | |||
| 1839 | static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) | 1825 | static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) |
| 1840 | { | 1826 | { |
| 1841 | idetape_tape_t *tape = drive->driver_data; | 1827 | idetape_tape_t *tape = drive->driver_data; |
| 1828 | struct gendisk *disk = tape->disk; | ||
| 1842 | struct ide_atapi_pc pc; | 1829 | struct ide_atapi_pc pc; |
| 1843 | int i, retval; | 1830 | int i, retval; |
| 1844 | 1831 | ||
| @@ -1877,7 +1864,7 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) | |||
| 1877 | ide_tape_discard_merge_buffer(drive, 0); | 1864 | ide_tape_discard_merge_buffer(drive, 0); |
| 1878 | idetape_create_load_unload_cmd(drive, &pc, | 1865 | idetape_create_load_unload_cmd(drive, &pc, |
| 1879 | IDETAPE_LU_LOAD_MASK); | 1866 | IDETAPE_LU_LOAD_MASK); |
| 1880 | return idetape_queue_pc_tail(drive, &pc); | 1867 | return ide_queue_pc_tail(drive, disk, &pc); |
| 1881 | case MTUNLOAD: | 1868 | case MTUNLOAD: |
| 1882 | case MTOFFL: | 1869 | case MTOFFL: |
| 1883 | /* | 1870 | /* |
| @@ -1891,7 +1878,7 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) | |||
| 1891 | ide_tape_discard_merge_buffer(drive, 0); | 1878 | ide_tape_discard_merge_buffer(drive, 0); |
| 1892 | idetape_create_load_unload_cmd(drive, &pc, | 1879 | idetape_create_load_unload_cmd(drive, &pc, |
| 1893 | !IDETAPE_LU_LOAD_MASK); | 1880 | !IDETAPE_LU_LOAD_MASK); |
| 1894 | retval = idetape_queue_pc_tail(drive, &pc); | 1881 | retval = ide_queue_pc_tail(drive, disk, &pc); |
| 1895 | if (!retval) | 1882 | if (!retval) |
| 1896 | clear_bit(IDE_AFLAG_MEDIUM_PRESENT, &drive->atapi_flags); | 1883 | clear_bit(IDE_AFLAG_MEDIUM_PRESENT, &drive->atapi_flags); |
| 1897 | return retval; | 1884 | return retval; |
| @@ -1902,14 +1889,14 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) | |||
| 1902 | ide_tape_discard_merge_buffer(drive, 0); | 1889 | ide_tape_discard_merge_buffer(drive, 0); |
| 1903 | idetape_create_load_unload_cmd(drive, &pc, | 1890 | idetape_create_load_unload_cmd(drive, &pc, |
| 1904 | IDETAPE_LU_RETENSION_MASK | IDETAPE_LU_LOAD_MASK); | 1891 | IDETAPE_LU_RETENSION_MASK | IDETAPE_LU_LOAD_MASK); |
| 1905 | return idetape_queue_pc_tail(drive, &pc); | 1892 | return ide_queue_pc_tail(drive, disk, &pc); |
| 1906 | case MTEOM: | 1893 | case MTEOM: |
| 1907 | idetape_create_space_cmd(&pc, 0, IDETAPE_SPACE_TO_EOD); | 1894 | idetape_create_space_cmd(&pc, 0, IDETAPE_SPACE_TO_EOD); |
| 1908 | return idetape_queue_pc_tail(drive, &pc); | 1895 | return ide_queue_pc_tail(drive, disk, &pc); |
| 1909 | case MTERASE: | 1896 | case MTERASE: |
| 1910 | (void)idetape_rewind_tape(drive); | 1897 | (void)idetape_rewind_tape(drive); |
| 1911 | idetape_create_erase_cmd(&pc); | 1898 | idetape_create_erase_cmd(&pc); |
| 1912 | return idetape_queue_pc_tail(drive, &pc); | 1899 | return ide_queue_pc_tail(drive, disk, &pc); |
| 1913 | case MTSETBLK: | 1900 | case MTSETBLK: |
| 1914 | if (mt_count) { | 1901 | if (mt_count) { |
| 1915 | if (mt_count < tape->blk_size || | 1902 | if (mt_count < tape->blk_size || |
| @@ -2018,7 +2005,7 @@ static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive) | |||
| 2018 | struct ide_atapi_pc pc; | 2005 | struct ide_atapi_pc pc; |
| 2019 | 2006 | ||
| 2020 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); | 2007 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); |
| 2021 | if (idetape_queue_pc_tail(drive, &pc)) { | 2008 | if (ide_queue_pc_tail(drive, tape->disk, &pc)) { |
| 2022 | printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); | 2009 | printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); |
| 2023 | if (tape->blk_size == 0) { | 2010 | if (tape->blk_size == 0) { |
| 2024 | printk(KERN_WARNING "ide-tape: Cannot deal with zero " | 2011 | printk(KERN_WARNING "ide-tape: Cannot deal with zero " |
| @@ -2170,7 +2157,7 @@ static void idetape_get_inquiry_results(ide_drive_t *drive) | |||
| 2170 | char fw_rev[4], vendor_id[8], product_id[16]; | 2157 | char fw_rev[4], vendor_id[8], product_id[16]; |
| 2171 | 2158 | ||
| 2172 | idetape_create_inquiry_cmd(&pc); | 2159 | idetape_create_inquiry_cmd(&pc); |
| 2173 | if (idetape_queue_pc_tail(drive, &pc)) { | 2160 | if (ide_queue_pc_tail(drive, tape->disk, &pc)) { |
| 2174 | printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n", | 2161 | printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n", |
| 2175 | tape->name); | 2162 | tape->name); |
| 2176 | return; | 2163 | return; |
| @@ -2199,7 +2186,7 @@ static void idetape_get_mode_sense_results(ide_drive_t *drive) | |||
| 2199 | u8 speed, max_speed; | 2186 | u8 speed, max_speed; |
| 2200 | 2187 | ||
| 2201 | idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); | 2188 | idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); |
| 2202 | if (idetape_queue_pc_tail(drive, &pc)) { | 2189 | if (ide_queue_pc_tail(drive, tape->disk, &pc)) { |
| 2203 | printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming" | 2190 | printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming" |
| 2204 | " some default values\n"); | 2191 | " some default values\n"); |
| 2205 | tape->blk_size = 512; | 2192 | tape->blk_size = 512; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 1bd49784e4da..b5be2368c96e 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
| @@ -1136,6 +1136,7 @@ enum { | |||
| 1136 | 1136 | ||
| 1137 | void ide_queue_pc_head(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *, | 1137 | void ide_queue_pc_head(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *, |
| 1138 | struct request *); | 1138 | struct request *); |
| 1139 | int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *); | ||
| 1139 | 1140 | ||
| 1140 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, | 1141 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, |
| 1141 | ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, | 1142 | ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, |
