Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146335
b: refs/heads/master
c: 746d5e4
h: refs/heads/master
i:
  146333: a0e7a69
  146331: 9b6d893
  146327: 2735314
  146319: 01c4604
  146303: b8a4aff
v: v3
  • Loading branch information
Borislav Petkov authored and Tejun Heo committed Apr 18, 2009
1 parent dfa13e7 commit 6544906
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 47 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: a1df5169f9bf08f6067029bfb840a05e282b1b97
refs/heads/master: 746d5e43274e9ea6cbd58818afc9239d41fb4e1e
54 changes: 12 additions & 42 deletions trunk/drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,56 +206,23 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
ide_cd_log_error(drive->name, failed_command, sense);
}

static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
struct request *failed_command)
{
struct cdrom_info *info = drive->driver_data;
struct request *rq = &drive->request_sense_rq;

ide_debug_log(IDE_DBG_SENSE, "enter");

if (sense == NULL)
sense = &info->sense_data;

memset(sense, 0, 18);

/* stuff the sense request in front of our current request */
blk_rq_init(NULL, rq);
rq->cmd_type = REQ_TYPE_ATA_PC;
rq->rq_disk = info->disk;

rq->data = sense;
rq->cmd[0] = GPCMD_REQUEST_SENSE;
rq->cmd[4] = 18;
rq->data_len = 18;

rq->cmd_type = REQ_TYPE_SENSE;
rq->cmd_flags |= REQ_PREEMPT;

/* NOTE! Save the failed command in "rq->special" */
rq->special = (void *)failed_command;

if (failed_command)
ide_debug_log(IDE_DBG_SENSE, "failed_cmd: 0x%x",
failed_command->cmd[0]);

drive->hwif->rq = NULL;

elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0);
}

static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq)
{
/*
* For REQ_TYPE_SENSE, "rq->special" points to the original
* failed request
*/
struct request *failed = (struct request *)rq->special;
struct cdrom_info *info = drive->driver_data;
void *sense = &info->sense_data;
struct request_sense *sense = &drive->sense_data;

if (failed) {
if (failed->sense) {
/*
* Sense is always read into drive->sense_data.
* Copy back if the failed request has its
* sense pointer set.
*/
memcpy(failed->sense, sense, 18);
sense = failed->sense;
failed->sense_len = rq->sense_len;
}
Expand Down Expand Up @@ -431,7 +398,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)

/* if we got a CHECK_CONDITION status, queue a request sense command */
if (stat & ATA_ERR)
cdrom_queue_request_sense(drive, NULL, NULL);
ide_queue_sense_rq(drive, NULL);
return 1;

end_request:
Expand All @@ -445,7 +412,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)

hwif->rq = NULL;

cdrom_queue_request_sense(drive, rq->sense, rq);
ide_queue_sense_rq(drive, rq);
return 1;
} else
return 2;
Expand Down Expand Up @@ -893,6 +860,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
goto out_end;
}

/* prepare sense request for this command */
ide_prep_sense(drive, rq);

memset(&cmd, 0, sizeof(cmd));

if (rq_data_dir(rq))
Expand Down
4 changes: 0 additions & 4 deletions trunk/drivers/ide/ide-cd.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ struct cdrom_info {

struct atapi_toc *toc;

/* The result of the last successful request sense command
on this device. */
struct request_sense sense_data;

u8 max_speed; /* Max speed of the drive. */
u8 current_speed; /* Current speed of the drive. */

Expand Down

0 comments on commit 6544906

Please sign in to comment.