aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-tape.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 3468ece98496..7b2032bc357b 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -155,7 +155,8 @@ typedef struct ide_tape_obj {
155 * other device. Note that at most we will have only one DSC (usually 155 * other device. Note that at most we will have only one DSC (usually
156 * data transfer) request in the device request queue. 156 * data transfer) request in the device request queue.
157 */ 157 */
158 struct request *postponed_rq; 158 bool postponed_rq;
159
159 /* The time in which we started polling for DSC */ 160 /* The time in which we started polling for DSC */
160 unsigned long dsc_polling_start; 161 unsigned long dsc_polling_start;
161 /* Timer used to poll for dsc */ 162 /* Timer used to poll for dsc */
@@ -372,15 +373,14 @@ static int ide_tape_callback(ide_drive_t *drive, int dsc)
372 * Postpone the current request so that ide.c will be able to service requests 373 * Postpone the current request so that ide.c will be able to service requests
373 * from another device on the same port while we are polling for DSC. 374 * from another device on the same port while we are polling for DSC.
374 */ 375 */
375static void idetape_postpone_request(ide_drive_t *drive) 376static void ide_tape_stall_queue(ide_drive_t *drive)
376{ 377{
377 idetape_tape_t *tape = drive->driver_data; 378 idetape_tape_t *tape = drive->driver_data;
378 struct request *rq = drive->hwif->rq;
379 379
380 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, dsc_poll_freq: %lu", 380 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, dsc_poll_freq: %lu",
381 rq->cmd[0], tape->dsc_poll_freq); 381 drive->hwif->rq->cmd[0], tape->dsc_poll_freq);
382 382
383 tape->postponed_rq = rq; 383 tape->postponed_rq = true;
384 384
385 ide_stall_queue(drive, tape->dsc_poll_freq); 385 ide_stall_queue(drive, tape->dsc_poll_freq);
386} 386}
@@ -394,7 +394,7 @@ static void ide_tape_handle_dsc(ide_drive_t *drive)
394 tape->dsc_poll_freq = IDETAPE_DSC_MA_FAST; 394 tape->dsc_poll_freq = IDETAPE_DSC_MA_FAST;
395 tape->dsc_timeout = jiffies + IDETAPE_DSC_MA_TIMEOUT; 395 tape->dsc_timeout = jiffies + IDETAPE_DSC_MA_TIMEOUT;
396 /* Allow ide.c to handle other requests */ 396 /* Allow ide.c to handle other requests */
397 idetape_postpone_request(drive); 397 ide_tape_stall_queue(drive);
398} 398}
399 399
400/* 400/*
@@ -567,7 +567,6 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
567 ide_hwif_t *hwif = drive->hwif; 567 ide_hwif_t *hwif = drive->hwif;
568 idetape_tape_t *tape = drive->driver_data; 568 idetape_tape_t *tape = drive->driver_data;
569 struct ide_atapi_pc *pc = NULL; 569 struct ide_atapi_pc *pc = NULL;
570 struct request *postponed_rq = tape->postponed_rq;
571 struct ide_cmd cmd; 570 struct ide_cmd cmd;
572 u8 stat; 571 u8 stat;
573 572
@@ -583,18 +582,6 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
583 goto out; 582 goto out;
584 } 583 }
585 584
586 if (postponed_rq != NULL)
587 if (rq != postponed_rq) {
588 printk(KERN_ERR "ide-tape: ide-tape.c bug - "
589 "Two DSC requests were queued\n");
590 drive->failed_pc = NULL;
591 rq->errors = 0;
592 ide_complete_rq(drive, 0, blk_rq_bytes(rq));
593 return ide_stopped;
594 }
595
596 tape->postponed_rq = NULL;
597
598 /* 585 /*
599 * If the tape is still busy, postpone our request and service 586 * If the tape is still busy, postpone our request and service
600 * the other device meanwhile. 587 * the other device meanwhile.
@@ -612,7 +599,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
612 599
613 if (!(drive->atapi_flags & IDE_AFLAG_IGNORE_DSC) && 600 if (!(drive->atapi_flags & IDE_AFLAG_IGNORE_DSC) &&
614 !(stat & ATA_DSC)) { 601 !(stat & ATA_DSC)) {
615 if (postponed_rq == NULL) { 602 if (!tape->postponed_rq) {
616 tape->dsc_polling_start = jiffies; 603 tape->dsc_polling_start = jiffies;
617 tape->dsc_poll_freq = tape->best_dsc_rw_freq; 604 tape->dsc_poll_freq = tape->best_dsc_rw_freq;
618 tape->dsc_timeout = jiffies + IDETAPE_DSC_RW_TIMEOUT; 605 tape->dsc_timeout = jiffies + IDETAPE_DSC_RW_TIMEOUT;
@@ -629,10 +616,12 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
629 tape->dsc_polling_start + 616 tape->dsc_polling_start +
630 IDETAPE_DSC_MA_THRESHOLD)) 617 IDETAPE_DSC_MA_THRESHOLD))
631 tape->dsc_poll_freq = IDETAPE_DSC_MA_SLOW; 618 tape->dsc_poll_freq = IDETAPE_DSC_MA_SLOW;
632 idetape_postpone_request(drive); 619 ide_tape_stall_queue(drive);
633 return ide_stopped; 620 return ide_stopped;
634 } else 621 } else {
635 drive->atapi_flags &= ~IDE_AFLAG_IGNORE_DSC; 622 drive->atapi_flags &= ~IDE_AFLAG_IGNORE_DSC;
623 tape->postponed_rq = false;
624 }
636 625
637 if (rq->cmd[13] & REQ_IDETAPE_READ) { 626 if (rq->cmd[13] & REQ_IDETAPE_READ) {
638 pc = &tape->queued_pc; 627 pc = &tape->queued_pc;