diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:28 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:28 -0500 |
commit | bbb89e3d7a7da7a4bac535c42da05143b2db5d71 (patch) | |
tree | a911dc16ebb41009b174095c4c3e704a39486b16 /drivers/ide/ide-cd.c | |
parent | 0d6f7e3a1845165b81adab3fc5fd13916f22aa61 (diff) |
ide-cd: unify request end exit path in cdrom_decode_status()
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 9d2e458250ba..c758e63b0fca 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -332,7 +332,6 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) | |||
332 | 332 | ||
333 | } else if (blk_pc_request(rq) || rq->cmd_type == REQ_TYPE_ATA_PC) { | 333 | } else if (blk_pc_request(rq) || rq->cmd_type == REQ_TYPE_ATA_PC) { |
334 | /* All other functions, except for READ. */ | 334 | /* All other functions, except for READ. */ |
335 | unsigned long flags; | ||
336 | 335 | ||
337 | /* | 336 | /* |
338 | * if we have an error, pass back CHECK_CONDITION as the | 337 | * if we have an error, pass back CHECK_CONDITION as the |
@@ -370,15 +369,7 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) | |||
370 | * remove failed request completely and end it when the | 369 | * remove failed request completely and end it when the |
371 | * request sense has completed | 370 | * request sense has completed |
372 | */ | 371 | */ |
373 | if (stat & ERR_STAT) { | 372 | goto end_request; |
374 | spin_lock_irqsave(&ide_lock, flags); | ||
375 | blkdev_dequeue_request(rq); | ||
376 | HWGROUP(drive)->rq = NULL; | ||
377 | spin_unlock_irqrestore(&ide_lock, flags); | ||
378 | |||
379 | cdrom_queue_request_sense(drive, rq->sense, rq); | ||
380 | } else | ||
381 | cdrom_end_request(drive, 0); | ||
382 | 373 | ||
383 | } else if (blk_fs_request(rq)) { | 374 | } else if (blk_fs_request(rq)) { |
384 | int do_end_request = 0; | 375 | int do_end_request = 0; |
@@ -458,23 +449,15 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) | |||
458 | sense data. We need this in order to perform end of media | 449 | sense data. We need this in order to perform end of media |
459 | processing */ | 450 | processing */ |
460 | 451 | ||
461 | if (do_end_request) { | 452 | if (do_end_request) |
462 | if (stat & ERR_STAT) { | 453 | goto end_request; |
463 | unsigned long flags; | ||
464 | spin_lock_irqsave(&ide_lock, flags); | ||
465 | blkdev_dequeue_request(rq); | ||
466 | HWGROUP(drive)->rq = NULL; | ||
467 | spin_unlock_irqrestore(&ide_lock, flags); | ||
468 | 454 | ||
469 | cdrom_queue_request_sense(drive, rq->sense, rq); | 455 | /* |
470 | } else | 456 | * If we got a CHECK_CONDITION status, |
471 | cdrom_end_request(drive, 0); | 457 | * queue a request sense command. |
472 | } else { | 458 | */ |
473 | /* If we got a CHECK_CONDITION status, | 459 | if (stat & ERR_STAT) |
474 | queue a request sense command. */ | 460 | cdrom_queue_request_sense(drive, NULL, NULL); |
475 | if (stat & ERR_STAT) | ||
476 | cdrom_queue_request_sense(drive, NULL, NULL); | ||
477 | } | ||
478 | } else { | 461 | } else { |
479 | blk_dump_rq_flags(rq, "ide-cd: bad rq"); | 462 | blk_dump_rq_flags(rq, "ide-cd: bad rq"); |
480 | cdrom_end_request(drive, 0); | 463 | cdrom_end_request(drive, 0); |
@@ -482,6 +465,21 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) | |||
482 | 465 | ||
483 | /* Retry, or handle the next request. */ | 466 | /* Retry, or handle the next request. */ |
484 | return 1; | 467 | return 1; |
468 | |||
469 | end_request: | ||
470 | if (stat & ERR_STAT) { | ||
471 | unsigned long flags; | ||
472 | |||
473 | spin_lock_irqsave(&ide_lock, flags); | ||
474 | blkdev_dequeue_request(rq); | ||
475 | HWGROUP(drive)->rq = NULL; | ||
476 | spin_unlock_irqrestore(&ide_lock, flags); | ||
477 | |||
478 | cdrom_queue_request_sense(drive, rq->sense, rq); | ||
479 | } else | ||
480 | cdrom_end_request(drive, 0); | ||
481 | |||
482 | return 1; | ||
485 | } | 483 | } |
486 | 484 | ||
487 | static int cdrom_timer_expiry(ide_drive_t *drive) | 485 | static int cdrom_timer_expiry(ide_drive_t *drive) |