aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@googlemail.com>2009-04-08 08:12:51 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-08 08:12:51 -0400
commit8e59bfde31e69fb1f630ec0efd24a50c5a51b0bf (patch)
tree216ccf55a754bcb6bfe35e68e0e83847067b41b4 /drivers/ide/ide-cd.c
parentcfd30daa0d6cbdb0bbc2bc40a10097231b23b204 (diff)
ide-cd: move status checking into the IRQ handler
There should be no functional change resulting from this patch. Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 35729a47f797..a4afd9082c4a 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -271,29 +271,18 @@ static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq)
271 * 1: if the request will be going through error recovery. 271 * 1: if the request will be going through error recovery.
272 * 2: if the request should be ended. 272 * 2: if the request should be ended.
273 */ 273 */
274static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) 274static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
275{ 275{
276 ide_hwif_t *hwif = drive->hwif; 276 ide_hwif_t *hwif = drive->hwif;
277 struct request *rq = hwif->rq; 277 struct request *rq = hwif->rq;
278 int stat, err, sense_key; 278 int err, sense_key;
279
280 /* check for errors */
281 stat = hwif->tp_ops->read_status(hwif);
282
283 if (stat_ret)
284 *stat_ret = stat;
285
286 if (OK_STAT(stat, good_stat, BAD_R_STAT))
287 return 0;
288 279
289 /* get the IDE error register */ 280 /* get the IDE error register */
290 err = ide_read_error(drive); 281 err = ide_read_error(drive);
291 sense_key = err >> 4; 282 sense_key = err >> 4;
292 283
293 ide_debug_log(IDE_DBG_RQ, "stat: 0x%x, good_stat: 0x%x, cmd[0]: 0x%x, " 284 ide_debug_log(IDE_DBG_RQ, "cmd[0]: 0x%x, rq->cmd_type: 0x%x, err: 0x%x",
294 "rq->cmd_type: 0x%x, err: 0x%x", 285 rq->cmd[0], rq->cmd_type, err);
295 stat, good_stat, rq->cmd[0], rq->cmd_type,
296 err);
297 286
298 if (blk_sense_request(rq)) { 287 if (blk_sense_request(rq)) {
299 /* 288 /*
@@ -624,12 +613,12 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
624 struct ide_cmd *cmd = &hwif->cmd; 613 struct ide_cmd *cmd = &hwif->cmd;
625 struct request *rq = hwif->rq; 614 struct request *rq = hwif->rq;
626 ide_expiry_t *expiry = NULL; 615 ide_expiry_t *expiry = NULL;
627 int dma_error = 0, dma, stat, thislen, uptodate = 0; 616 int dma_error = 0, dma, thislen, uptodate = 0;
628 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc, nsectors; 617 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc, nsectors;
629 int sense = blk_sense_request(rq); 618 int sense = blk_sense_request(rq);
630 unsigned int timeout; 619 unsigned int timeout;
631 u16 len; 620 u16 len;
632 u8 ireason; 621 u8 ireason, stat;
633 622
634 ide_debug_log(IDE_DBG_PC, "cmd[0]: 0x%x, write: 0x%x", 623 ide_debug_log(IDE_DBG_PC, "cmd[0]: 0x%x, write: 0x%x",
635 rq->cmd[0], write); 624 rq->cmd[0], write);
@@ -648,11 +637,16 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
648 } 637 }
649 } 638 }
650 639
651 rc = cdrom_decode_status(drive, 0, &stat); 640 /* check status */
652 if (rc) { 641 stat = hwif->tp_ops->read_status(hwif);
653 if (rc == 2) 642
654 goto out_end; 643 if (!OK_STAT(stat, 0, BAD_R_STAT)) {
655 return ide_stopped; 644 rc = cdrom_decode_status(drive, stat);
645 if (rc) {
646 if (rc == 2)
647 goto out_end;
648 return ide_stopped;
649 }
656 } 650 }
657 651
658 /* using dma, transfer is complete now */ 652 /* using dma, transfer is complete now */