Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142970
b: refs/heads/master
c: 1920c48
h: refs/heads/master
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Apr 8, 2009
1 parent a050654 commit 9c40bf8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 46 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: e01f251fd09fa7cb3d352eac7de17bb5d5bd1f9d
refs/heads/master: 1920c48d796ce7240ba267cb0be85c51895258f8
69 changes: 24 additions & 45 deletions trunk/drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
*/
rq->cmd_flags |= REQ_FAILED;
return 2;
} else if (blk_pc_request(rq) || rq->cmd_type == REQ_TYPE_ATA_PC) {
/* All other functions, except for READ. */
} else {
int do_end_request = 0;

/*
* if we have an error, pass back CHECK_CONDITION as the
Expand All @@ -340,53 +340,16 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
if (blk_pc_request(rq) && !rq->errors)
rq->errors = SAM_STAT_CHECK_CONDITION;

switch (sense_key) {
case NOT_READY:
cdrom_saw_media_change(drive);
break;
case UNIT_ATTENTION:
cdrom_saw_media_change(drive);
return 0;
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!
*/
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;

/*
* instead of playing games with moving completions around,
* remove failed request completely and end it when the
* request sense has completed
*/
goto end_request;

} else if (blk_fs_request(rq)) {
int do_end_request = 0;

/* handle errors from READ and WRITE requests */

if (blk_noretry_request(rq))
do_end_request = 1;

switch (sense_key) {
case NOT_READY:
if (rq_data_dir(rq) == READ) {
if (blk_fs_request(rq) == 0 ||
rq_data_dir(rq) == READ) {
cdrom_saw_media_change(drive);

if (!quiet)
if (blk_fs_request(rq) && !quiet)
printk(KERN_ERR PFX "%s: tray open\n",
drive->name);
} else {
Expand All @@ -398,6 +361,8 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
case UNIT_ATTENTION:
cdrom_saw_media_change(drive);

if (blk_fs_request(rq) == 0)
return 0;
/*
* Arrange to retry the request but be sure to give up
* if we've retried too many times.
Expand All @@ -406,6 +371,16 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
do_end_request = 1;
break;
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!
*/
if (rq->cmd[0] == GPCMD_START_STOP_UNIT)
break;
/* fall-through */
case DATA_PROTECT:
/*
* No point in retrying after an illegal request or data
Expand Down Expand Up @@ -433,6 +408,8 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
do_end_request = 1;
break;
default:
if (blk_fs_request(rq) == 0)
break;
if (err & ~ATA_ABORTED) {
/* go to the default handler for other errors */
ide_error(drive, "cdrom_decode_status", stat);
Expand All @@ -442,6 +419,11 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
do_end_request = 1;
}

if (blk_fs_request(rq) == 0) {
rq->cmd_flags |= REQ_FAILED;
do_end_request = 1;
}

/*
* End a request through request sense analysis when we have
* sense data. We need this in order to perform end of media
Expand All @@ -457,9 +439,6 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
if (stat & ATA_ERR)
cdrom_queue_request_sense(drive, NULL, NULL);
return 1;
} else {
blk_dump_rq_flags(rq, PFX "bad rq");
return 2;
}

end_request:
Expand Down

0 comments on commit 9c40bf8

Please sign in to comment.