ide-cd: use whole request_sense buffer in EH

Now that we use a static request_sense buffer, use it instead of the
first 18 bytes only. Also, remove sense-arg to cdrom_analyze_sense_data
and cdrom_log_sense since we can access it through drive->sense_data
now.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
This commit is contained in:
Borislav Petkov 2009-04-23 08:30:29 +02:00
parent 19f52a784f
commit 239f7e2534

View File

@ -92,16 +92,16 @@ static void cdrom_saw_media_change(ide_drive_t *drive)
drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID; drive->atapi_flags &= ~IDE_AFLAG_TOC_VALID;
} }
static int cdrom_log_sense(ide_drive_t *drive, struct request *rq, static int cdrom_log_sense(ide_drive_t *drive, struct request *rq)
struct request_sense *sense)
{ {
struct request_sense *sense = &drive->sense_data;
int log = 0; int log = 0;
ide_debug_log(IDE_DBG_SENSE, "sense_key: 0x%x", sense->sense_key);
if (!sense || !rq || (rq->cmd_flags & REQ_QUIET)) if (!sense || !rq || (rq->cmd_flags & REQ_QUIET))
return 0; return 0;
ide_debug_log(IDE_DBG_SENSE, "sense_key: 0x%x", sense->sense_key);
switch (sense->sense_key) { switch (sense->sense_key) {
case NO_SENSE: case NO_SENSE:
case RECOVERED_ERROR: case RECOVERED_ERROR:
@ -140,12 +140,12 @@ static int cdrom_log_sense(ide_drive_t *drive, struct request *rq,
} }
static void cdrom_analyze_sense_data(ide_drive_t *drive, static void cdrom_analyze_sense_data(ide_drive_t *drive,
struct request *failed_command, struct request *failed_command)
struct request_sense *sense)
{ {
struct request_sense *sense = &drive->sense_data;
struct cdrom_info *info = drive->driver_data;
unsigned long sector; unsigned long sector;
unsigned long bio_sectors; unsigned long bio_sectors;
struct cdrom_info *info = drive->driver_data;
ide_debug_log(IDE_DBG_SENSE, "error_code: 0x%x, sense_key: 0x%x", ide_debug_log(IDE_DBG_SENSE, "error_code: 0x%x, sense_key: 0x%x",
sense->error_code, sense->sense_key); sense->error_code, sense->sense_key);
@ -154,7 +154,7 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
ide_debug_log(IDE_DBG_SENSE, "failed cmd: 0x%x", ide_debug_log(IDE_DBG_SENSE, "failed cmd: 0x%x",
failed_command->cmd[0]); failed_command->cmd[0]);
if (!cdrom_log_sense(drive, failed_command, sense)) if (!cdrom_log_sense(drive, failed_command))
return; return;
/* /*
@ -225,15 +225,14 @@ static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq)
* sense pointer set. * sense pointer set.
*/ */
memcpy(failed->sense, sense, 18); memcpy(failed->sense, sense, 18);
sense = failed->sense;
failed->sense_len = rq->sense_len; failed->sense_len = rq->sense_len;
} }
cdrom_analyze_sense_data(drive, failed, sense); cdrom_analyze_sense_data(drive, failed);
if (ide_end_rq(drive, failed, -EIO, blk_rq_bytes(failed))) if (ide_end_rq(drive, failed, -EIO, blk_rq_bytes(failed)))
BUG(); BUG();
} else } else
cdrom_analyze_sense_data(drive, NULL, sense); cdrom_analyze_sense_data(drive, NULL);
} }