Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142969
b: refs/heads/master
c: e01f251
h: refs/heads/master
i:
  142967: 3caa7fb
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Apr 8, 2009
1 parent 0a79ca8 commit a050654
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 98036abf31994244cb5772ecc291f4293a52c20b
refs/heads/master: e01f251fd09fa7cb3d352eac7de17bb5d5bd1f9d
57 changes: 32 additions & 25 deletions trunk/drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,25 +340,28 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
if (blk_pc_request(rq) && !rq->errors)
rq->errors = SAM_STAT_CHECK_CONDITION;

/* check for tray open */
if (sense_key == NOT_READY) {
switch (sense_key) {
case NOT_READY:
cdrom_saw_media_change(drive);
} else if (sense_key == UNIT_ATTENTION) {
/* check for media change */
break;
case UNIT_ATTENTION:
cdrom_saw_media_change(drive);
return 0;
} else if (sense_key == ILLEGAL_REQUEST &&
rq->cmd[0] == GPCMD_START_STOP_UNIT) {
case ILLEGAL_REQUEST:
/*
* Don't print error message for this condition--
* SFF8090i indicates that 5/24/00 is the correct
* response to a request to close the tray if the
* drive doesn't have that capability.
* cdrom_log_sense() knows this!
*/
} else if (!quiet) {
/* otherwise, print an error */
ide_dump_status(drive, "packet command error", stat);
if (rq->cmd[0] == GPCMD_START_STOP_UNIT)
break;
/* fall-through */
default:
if (!quiet)
ide_dump_status(drive, "packet command error",
stat);
}

rq->cmd_flags |= REQ_FAILED;
Expand All @@ -378,12 +381,11 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
if (blk_noretry_request(rq))
do_end_request = 1;

if (sense_key == NOT_READY) {
/* tray open */
switch (sense_key) {
case NOT_READY:
if (rq_data_dir(rq) == READ) {
cdrom_saw_media_change(drive);

/* fail the request */
if (!quiet)
printk(KERN_ERR PFX "%s: tray open\n",
drive->name);
Expand All @@ -392,8 +394,8 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
return 1;
}
do_end_request = 1;
} else if (sense_key == UNIT_ATTENTION) {
/* media change */
break;
case UNIT_ATTENTION:
cdrom_saw_media_change(drive);

/*
Expand All @@ -402,16 +404,18 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
*/
if (++rq->errors > ERROR_MAX)
do_end_request = 1;
} else if (sense_key == ILLEGAL_REQUEST ||
sense_key == DATA_PROTECT) {
break;
case ILLEGAL_REQUEST:
case DATA_PROTECT:
/*
* No point in retrying after an illegal request or data
* protect error.
*/
if (!quiet)
ide_dump_status(drive, "command error", stat);
do_end_request = 1;
} else if (sense_key == MEDIUM_ERROR) {
break;
case MEDIUM_ERROR:
/*
* No point in re-trying a zillion times on a bad
* sector. If we got here the error is not correctable.
Expand All @@ -420,19 +424,22 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
ide_dump_status(drive, "media error "
"(bad sector)", stat);
do_end_request = 1;
} else if (sense_key == BLANK_CHECK) {
break;
case BLANK_CHECK:
/* disk appears blank ?? */
if (!quiet)
ide_dump_status(drive, "media error (blank)",
stat);
do_end_request = 1;
} else if ((err & ~ATA_ABORTED) != 0) {
/* go to the default handler for other errors */
ide_error(drive, "cdrom_decode_status", stat);
return 1;
} else if ((++rq->errors > ERROR_MAX)) {
/* we've racked up too many retries, abort */
do_end_request = 1;
break;
default:
if (err & ~ATA_ABORTED) {
/* go to the default handler for other errors */
ide_error(drive, "cdrom_decode_status", stat);
return 1;
} else if (++rq->errors > ERROR_MAX)
/* we've racked up too many retries, abort */
do_end_request = 1;
}

/*
Expand Down

0 comments on commit a050654

Please sign in to comment.