diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-31 14:15:01 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-31 14:15:01 -0400 |
commit | 299c4852fc6995e0665d246927d25cefd4dad754 (patch) | |
tree | 4c1812b1e45e48ca9e014cd95df90193a42bc668 /drivers/ide/ide-cd.c | |
parent | 6041e8fba8b9a9a64bd7402be700b0f1247a9c55 (diff) |
ide-cd: factor out failed request completion from cdrom_end_request()
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
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; |