diff options
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 54 |
1 files changed, 12 insertions, 42 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index bb77c79c1018..061d7bbcd34a 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -206,44 +206,6 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
206 | ide_cd_log_error(drive->name, failed_command, sense); | 206 | ide_cd_log_error(drive->name, failed_command, sense); |
207 | } | 207 | } |
208 | 208 | ||
209 | static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, | ||
210 | struct request *failed_command) | ||
211 | { | ||
212 | struct cdrom_info *info = drive->driver_data; | ||
213 | struct request *rq = &drive->request_sense_rq; | ||
214 | |||
215 | ide_debug_log(IDE_DBG_SENSE, "enter"); | ||
216 | |||
217 | if (sense == NULL) | ||
218 | sense = &info->sense_data; | ||
219 | |||
220 | memset(sense, 0, 18); | ||
221 | |||
222 | /* stuff the sense request in front of our current request */ | ||
223 | blk_rq_init(NULL, rq); | ||
224 | rq->cmd_type = REQ_TYPE_ATA_PC; | ||
225 | rq->rq_disk = info->disk; | ||
226 | |||
227 | rq->data = sense; | ||
228 | rq->cmd[0] = GPCMD_REQUEST_SENSE; | ||
229 | rq->cmd[4] = 18; | ||
230 | rq->data_len = 18; | ||
231 | |||
232 | rq->cmd_type = REQ_TYPE_SENSE; | ||
233 | rq->cmd_flags |= REQ_PREEMPT; | ||
234 | |||
235 | /* NOTE! Save the failed command in "rq->special" */ | ||
236 | rq->special = (void *)failed_command; | ||
237 | |||
238 | if (failed_command) | ||
239 | ide_debug_log(IDE_DBG_SENSE, "failed_cmd: 0x%x", | ||
240 | failed_command->cmd[0]); | ||
241 | |||
242 | drive->hwif->rq = NULL; | ||
243 | |||
244 | elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0); | ||
245 | } | ||
246 | |||
247 | static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq) | 209 | static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq) |
248 | { | 210 | { |
249 | /* | 211 | /* |
@@ -251,11 +213,16 @@ static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq) | |||
251 | * failed request | 213 | * failed request |
252 | */ | 214 | */ |
253 | struct request *failed = (struct request *)rq->special; | 215 | struct request *failed = (struct request *)rq->special; |
254 | struct cdrom_info *info = drive->driver_data; | 216 | struct request_sense *sense = &drive->sense_data; |
255 | void *sense = &info->sense_data; | ||
256 | 217 | ||
257 | if (failed) { | 218 | if (failed) { |
258 | if (failed->sense) { | 219 | if (failed->sense) { |
220 | /* | ||
221 | * Sense is always read into drive->sense_data. | ||
222 | * Copy back if the failed request has its | ||
223 | * sense pointer set. | ||
224 | */ | ||
225 | memcpy(failed->sense, sense, 18); | ||
259 | sense = failed->sense; | 226 | sense = failed->sense; |
260 | failed->sense_len = rq->sense_len; | 227 | failed->sense_len = rq->sense_len; |
261 | } | 228 | } |
@@ -431,7 +398,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
431 | 398 | ||
432 | /* if we got a CHECK_CONDITION status, queue a request sense command */ | 399 | /* if we got a CHECK_CONDITION status, queue a request sense command */ |
433 | if (stat & ATA_ERR) | 400 | if (stat & ATA_ERR) |
434 | cdrom_queue_request_sense(drive, NULL, NULL); | 401 | ide_queue_sense_rq(drive, NULL); |
435 | return 1; | 402 | return 1; |
436 | 403 | ||
437 | end_request: | 404 | end_request: |
@@ -445,7 +412,7 @@ end_request: | |||
445 | 412 | ||
446 | hwif->rq = NULL; | 413 | hwif->rq = NULL; |
447 | 414 | ||
448 | cdrom_queue_request_sense(drive, rq->sense, rq); | 415 | ide_queue_sense_rq(drive, rq); |
449 | return 1; | 416 | return 1; |
450 | } else | 417 | } else |
451 | return 2; | 418 | return 2; |
@@ -893,6 +860,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
893 | goto out_end; | 860 | goto out_end; |
894 | } | 861 | } |
895 | 862 | ||
863 | /* prepare sense request for this command */ | ||
864 | ide_prep_sense(drive, rq); | ||
865 | |||
896 | memset(&cmd, 0, sizeof(cmd)); | 866 | memset(&cmd, 0, sizeof(cmd)); |
897 | 867 | ||
898 | if (rq_data_dir(rq)) | 868 | if (rq_data_dir(rq)) |