diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-atapi.c | 9 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 20 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.h | 2 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 31 |
4 files changed, 25 insertions, 37 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index fb27c94aeb0d..0069c4f08244 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -204,12 +204,13 @@ int ide_set_media_lock(ide_drive_t *drive, struct gendisk *disk, int on) | |||
204 | EXPORT_SYMBOL_GPL(ide_set_media_lock); | 204 | EXPORT_SYMBOL_GPL(ide_set_media_lock); |
205 | 205 | ||
206 | /* TODO: unify the code thus making some arguments go away */ | 206 | /* TODO: unify the code thus making some arguments go away */ |
207 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, | 207 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, |
208 | ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, | 208 | ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, |
209 | void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *), | 209 | void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *), |
210 | void (*retry_pc)(ide_drive_t *), | 210 | void (*retry_pc)(ide_drive_t *), |
211 | int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int)) | 211 | int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int)) |
212 | { | 212 | { |
213 | struct ide_atapi_pc *pc = drive->pc; | ||
213 | ide_hwif_t *hwif = drive->hwif; | 214 | ide_hwif_t *hwif = drive->hwif; |
214 | struct request *rq = hwif->hwgroup->rq; | 215 | struct request *rq = hwif->hwgroup->rq; |
215 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 216 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
@@ -416,10 +417,11 @@ static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason) | |||
416 | return ireason; | 417 | return ireason; |
417 | } | 418 | } |
418 | 419 | ||
419 | ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc, | 420 | ide_startstop_t ide_transfer_pc(ide_drive_t *drive, |
420 | ide_handler_t *handler, unsigned int timeout, | 421 | ide_handler_t *handler, unsigned int timeout, |
421 | ide_expiry_t *expiry) | 422 | ide_expiry_t *expiry) |
422 | { | 423 | { |
424 | struct ide_atapi_pc *pc = drive->pc; | ||
423 | ide_hwif_t *hwif = drive->hwif; | 425 | ide_hwif_t *hwif = drive->hwif; |
424 | struct request *rq = hwif->hwgroup->rq; | 426 | struct request *rq = hwif->hwgroup->rq; |
425 | ide_startstop_t startstop; | 427 | ide_startstop_t startstop; |
@@ -458,10 +460,11 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc, | |||
458 | } | 460 | } |
459 | EXPORT_SYMBOL_GPL(ide_transfer_pc); | 461 | EXPORT_SYMBOL_GPL(ide_transfer_pc); |
460 | 462 | ||
461 | ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_atapi_pc *pc, | 463 | ide_startstop_t ide_issue_pc(ide_drive_t *drive, |
462 | ide_handler_t *handler, unsigned int timeout, | 464 | ide_handler_t *handler, unsigned int timeout, |
463 | ide_expiry_t *expiry) | 465 | ide_expiry_t *expiry) |
464 | { | 466 | { |
467 | struct ide_atapi_pc *pc = drive->pc; | ||
465 | ide_hwif_t *hwif = drive->hwif; | 468 | ide_hwif_t *hwif = drive->hwif; |
466 | u16 bcount; | 469 | u16 bcount; |
467 | u8 dma = 0; | 470 | u8 dma = 0; |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index b33080675f6b..cb89caf07913 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -159,7 +159,7 @@ static void idefloppy_update_buffers(ide_drive_t *drive, | |||
159 | static void ide_floppy_callback(ide_drive_t *drive, int dsc) | 159 | static void ide_floppy_callback(ide_drive_t *drive, int dsc) |
160 | { | 160 | { |
161 | idefloppy_floppy_t *floppy = drive->driver_data; | 161 | idefloppy_floppy_t *floppy = drive->driver_data; |
162 | struct ide_atapi_pc *pc = floppy->pc; | 162 | struct ide_atapi_pc *pc = drive->pc; |
163 | int uptodate = pc->error ? 0 : 1; | 163 | int uptodate = pc->error ? 0 : 1; |
164 | 164 | ||
165 | debug_log("Reached %s\n", __func__); | 165 | debug_log("Reached %s\n", __func__); |
@@ -171,7 +171,7 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) | |||
171 | (pc->rq && blk_pc_request(pc->rq))) | 171 | (pc->rq && blk_pc_request(pc->rq))) |
172 | uptodate = 1; /* FIXME */ | 172 | uptodate = 1; /* FIXME */ |
173 | else if (pc->c[0] == GPCMD_REQUEST_SENSE) { | 173 | else if (pc->c[0] == GPCMD_REQUEST_SENSE) { |
174 | u8 *buf = floppy->pc->buf; | 174 | u8 *buf = pc->buf; |
175 | 175 | ||
176 | if (!pc->error) { | 176 | if (!pc->error) { |
177 | floppy->sense_key = buf[2] & 0x0F; | 177 | floppy->sense_key = buf[2] & 0x0F; |
@@ -219,9 +219,7 @@ static void idefloppy_retry_pc(ide_drive_t *drive) | |||
219 | /* The usual interrupt handler called during a packet command. */ | 219 | /* The usual interrupt handler called during a packet command. */ |
220 | static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive) | 220 | static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive) |
221 | { | 221 | { |
222 | idefloppy_floppy_t *floppy = drive->driver_data; | 222 | return ide_pc_intr(drive, idefloppy_pc_intr, |
223 | |||
224 | return ide_pc_intr(drive, floppy->pc, idefloppy_pc_intr, | ||
225 | WAIT_FLOPPY_CMD, NULL, idefloppy_update_buffers, | 223 | WAIT_FLOPPY_CMD, NULL, idefloppy_update_buffers, |
226 | idefloppy_retry_pc, ide_io_buffers); | 224 | idefloppy_retry_pc, ide_io_buffers); |
227 | } | 225 | } |
@@ -234,10 +232,8 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive) | |||
234 | */ | 232 | */ |
235 | static int idefloppy_transfer_pc(ide_drive_t *drive) | 233 | static int idefloppy_transfer_pc(ide_drive_t *drive) |
236 | { | 234 | { |
237 | idefloppy_floppy_t *floppy = drive->driver_data; | ||
238 | |||
239 | /* Send the actual packet */ | 235 | /* Send the actual packet */ |
240 | drive->hwif->tp_ops->output_data(drive, NULL, floppy->pc->c, 12); | 236 | drive->hwif->tp_ops->output_data(drive, NULL, drive->pc->c, 12); |
241 | 237 | ||
242 | /* Timeout for the packet command */ | 238 | /* Timeout for the packet command */ |
243 | return WAIT_FLOPPY_CMD; | 239 | return WAIT_FLOPPY_CMD; |
@@ -251,7 +247,6 @@ static int idefloppy_transfer_pc(ide_drive_t *drive) | |||
251 | static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive) | 247 | static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive) |
252 | { | 248 | { |
253 | idefloppy_floppy_t *floppy = drive->driver_data; | 249 | idefloppy_floppy_t *floppy = drive->driver_data; |
254 | struct ide_atapi_pc *pc = floppy->pc; | ||
255 | ide_expiry_t *expiry; | 250 | ide_expiry_t *expiry; |
256 | unsigned int timeout; | 251 | unsigned int timeout; |
257 | 252 | ||
@@ -271,7 +266,7 @@ static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive) | |||
271 | expiry = NULL; | 266 | expiry = NULL; |
272 | } | 267 | } |
273 | 268 | ||
274 | return ide_transfer_pc(drive, pc, idefloppy_pc_intr, timeout, expiry); | 269 | return ide_transfer_pc(drive, idefloppy_pc_intr, timeout, expiry); |
275 | } | 270 | } |
276 | 271 | ||
277 | static void ide_floppy_report_error(idefloppy_floppy_t *floppy, | 272 | static void ide_floppy_report_error(idefloppy_floppy_t *floppy, |
@@ -298,8 +293,9 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
298 | if (floppy->failed_pc == NULL && | 293 | if (floppy->failed_pc == NULL && |
299 | pc->c[0] != GPCMD_REQUEST_SENSE) | 294 | pc->c[0] != GPCMD_REQUEST_SENSE) |
300 | floppy->failed_pc = pc; | 295 | floppy->failed_pc = pc; |
296 | |||
301 | /* Set the current packet command */ | 297 | /* Set the current packet command */ |
302 | floppy->pc = pc; | 298 | drive->pc = pc; |
303 | 299 | ||
304 | if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES) { | 300 | if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES) { |
305 | if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) | 301 | if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) |
@@ -316,7 +312,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
316 | 312 | ||
317 | pc->retries++; | 313 | pc->retries++; |
318 | 314 | ||
319 | return ide_issue_pc(drive, pc, idefloppy_start_pc_transfer, | 315 | return ide_issue_pc(drive, idefloppy_start_pc_transfer, |
320 | WAIT_FLOPPY_CMD, NULL); | 316 | WAIT_FLOPPY_CMD, NULL); |
321 | } | 317 | } |
322 | 318 | ||
diff --git a/drivers/ide/ide-floppy.h b/drivers/ide/ide-floppy.h index ecadc2bc322d..6eee8d3a7243 100644 --- a/drivers/ide/ide-floppy.h +++ b/drivers/ide/ide-floppy.h | |||
@@ -13,8 +13,6 @@ typedef struct ide_floppy_obj { | |||
13 | struct kref kref; | 13 | struct kref kref; |
14 | unsigned int openers; /* protected by BKL for now */ | 14 | unsigned int openers; /* protected by BKL for now */ |
15 | 15 | ||
16 | /* Current packet command */ | ||
17 | struct ide_atapi_pc *pc; | ||
18 | /* Last failed packet command */ | 16 | /* Last failed packet command */ |
19 | struct ide_atapi_pc *failed_pc; | 17 | struct ide_atapi_pc *failed_pc; |
20 | /* used for blk_{fs,pc}_request() requests */ | 18 | /* used for blk_{fs,pc}_request() requests */ |
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 *); | |||
527 | static void ide_tape_callback(ide_drive_t *drive, int dsc) | 523 | static 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 | */ |
660 | static ide_startstop_t idetape_pc_intr(ide_drive_t *drive) | 656 | static 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 | */ |
705 | static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) | 699 | static 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 | ||
713 | static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, | 704 | static 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 | } |