diff options
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 9d3150f549fe..eb0c2fe2b874 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -242,6 +242,29 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, | |||
242 | elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0); | 242 | elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0); |
243 | } | 243 | } |
244 | 244 | ||
245 | static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq) | ||
246 | { | ||
247 | /* | ||
248 | * For REQ_TYPE_SENSE, "rq->buffer" points to the original | ||
249 | * failed request | ||
250 | */ | ||
251 | struct request *failed = (struct request *)rq->buffer; | ||
252 | struct cdrom_info *info = drive->driver_data; | ||
253 | void *sense = &info->sense_data; | ||
254 | |||
255 | if (failed) { | ||
256 | if (failed->sense) { | ||
257 | sense = failed->sense; | ||
258 | failed->sense_len = rq->sense_len; | ||
259 | } | ||
260 | cdrom_analyze_sense_data(drive, failed, sense); | ||
261 | |||
262 | if (ide_end_rq(drive, failed, -EIO, blk_rq_bytes(failed))) | ||
263 | BUG(); | ||
264 | } else | ||
265 | cdrom_analyze_sense_data(drive, NULL, sense); | ||
266 | } | ||
267 | |||
245 | static void cdrom_end_request(ide_drive_t *drive, int uptodate) | 268 | static void cdrom_end_request(ide_drive_t *drive, int uptodate) |
246 | { | 269 | { |
247 | struct request *rq = drive->hwif->rq; | 270 | struct request *rq = drive->hwif->rq; |
@@ -250,28 +273,8 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate) | |||
250 | ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, uptodate: 0x%x, nsectors: %d", | 273 | ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, uptodate: 0x%x, nsectors: %d", |
251 | rq->cmd[0], uptodate, nsectors); | 274 | rq->cmd[0], uptodate, nsectors); |
252 | 275 | ||
253 | if (blk_sense_request(rq) && uptodate) { | 276 | if (blk_sense_request(rq) && uptodate) |
254 | /* | 277 | ide_cd_complete_failed_rq(drive, rq); |
255 | * For REQ_TYPE_SENSE, "rq->buffer" points to the original | ||
256 | * failed request | ||
257 | */ | ||
258 | struct request *failed = (struct request *) rq->buffer; | ||
259 | struct cdrom_info *info = drive->driver_data; | ||
260 | void *sense = &info->sense_data; | ||
261 | |||
262 | if (failed) { | ||
263 | if (failed->sense) { | ||
264 | sense = failed->sense; | ||
265 | failed->sense_len = rq->sense_len; | ||
266 | } | ||
267 | cdrom_analyze_sense_data(drive, failed, sense); | ||
268 | |||
269 | if (ide_end_rq(drive, failed, -EIO, | ||
270 | blk_rq_bytes(failed))) | ||
271 | BUG(); | ||
272 | } else | ||
273 | cdrom_analyze_sense_data(drive, NULL, sense); | ||
274 | } | ||
275 | 278 | ||
276 | if (!rq->current_nr_sectors && blk_fs_request(rq)) | 279 | if (!rq->current_nr_sectors && blk_fs_request(rq)) |
277 | uptodate = 1; | 280 | uptodate = 1; |