Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139411
b: refs/heads/master
c: 8a11697
h: refs/heads/master
i:
  139409: 88e56fa
  139407: 0463946
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Mar 31, 2009
1 parent 1b212f8 commit ed5c3f4
Show file tree
Hide file tree
Showing 2 changed files with 24 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: 984c5e5974227d2d4dba58cdf19af641f89be83f
refs/heads/master: 8a116974852a727bdfe6b1b897102903a17228a5
48 changes: 23 additions & 25 deletions trunk/drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate)
/*
* Returns:
* 0: if the request should be continued.
* 1: if the request was ended.
* 1: if the request will be going through error recovery.
* 2: if the request should be ended.
*/
static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
{
Expand Down Expand Up @@ -329,10 +330,7 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
* Just give up.
*/
rq->cmd_flags |= REQ_FAILED;
cdrom_end_request(drive, 0);
ide_error(drive, "request sense failure", stat);
return 1;

return 2;
} else if (blk_pc_request(rq) || rq->cmd_type == REQ_TYPE_ATA_PC) {
/* All other functions, except for READ. */

Expand Down Expand Up @@ -472,14 +470,12 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
*/
if (stat & ATA_ERR)
cdrom_queue_request_sense(drive, NULL, NULL);
return 1;
} else {
blk_dump_rq_flags(rq, PFX "bad rq");
cdrom_end_request(drive, 0);
return 2;
}

/* retry, or handle the next request */
return 1;

end_request:
if (stat & ATA_ERR) {
struct request_queue *q = drive->queue;
Expand All @@ -492,10 +488,9 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
hwif->rq = NULL;

cdrom_queue_request_sense(drive, rq->sense, rq);
return 1;
} else
cdrom_end_request(drive, 0);

return 1;
return 2;
}

/*
Expand Down Expand Up @@ -539,7 +534,6 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
if (rq->cmd_type == REQ_TYPE_ATA_PC)
rq->cmd_flags |= REQ_FAILED;

cdrom_end_request(drive, 0);
return -1;
}

Expand Down Expand Up @@ -741,7 +735,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
xfer_func_t *xferfunc;
ide_expiry_t *expiry = NULL;
int dma_error = 0, dma, stat, thislen, uptodate = 0;
int write = (rq_data_dir(rq) == WRITE) ? 1 : 0;
int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc;
int sense = blk_sense_request(rq);
unsigned int timeout;
u16 len;
u8 ireason;
Expand All @@ -761,8 +756,12 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
}
}

if (cdrom_decode_status(drive, 0, &stat))
rc = cdrom_decode_status(drive, 0, &stat);
if (rc) {
if (rc == 2)
goto out_end;
return ide_stopped;
}

/* using dma, transfer is complete now */
if (dma) {
Expand Down Expand Up @@ -807,8 +806,6 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
rq->cmd_flags |= REQ_FAILED;
uptodate = 0;
}
cdrom_end_request(drive, uptodate);
return ide_stopped;
} else if (!blk_pc_request(rq)) {
ide_cd_request_sense_fixup(drive, rq);
/* complain if we still have data left to transfer */
Expand All @@ -820,17 +817,16 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
}

/* check which way to transfer data */
if (ide_cd_check_ireason(drive, rq, len, ireason, write))
return ide_stopped;
rc = ide_cd_check_ireason(drive, rq, len, ireason, write);
if (rc)
goto out_end;

if (blk_fs_request(rq)) {
if (write == 0) {
int nskip;

if (ide_cd_check_transfer_size(drive, len)) {
cdrom_end_request(drive, 0);
return ide_stopped;
}
if (ide_cd_check_transfer_size(drive, len))
goto out_end;

/*
* First, figure out if we need to bit-bucket
Expand Down Expand Up @@ -923,7 +919,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
else
rq->data += blen;
}
if (!write && blk_sense_request(rq))
if (sense && write == 0)
rq->sense_len += blen;
}

Expand All @@ -944,7 +940,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
return ide_started;

out_end:
if (blk_pc_request(rq)) {
if (blk_pc_request(rq) && rc == 0) {
unsigned int dlen = rq->data_len;

if (dma)
Expand All @@ -956,6 +952,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
hwif->rq = NULL;
} else {
cdrom_end_request(drive, uptodate);
if (sense && rc == 2)
ide_error(drive, "request sense failure", stat);
}
return ide_stopped;
}
Expand Down

0 comments on commit ed5c3f4

Please sign in to comment.