ide-cd: fix intendation in cdrom_decode_status()

Based on earlier work by Borislav Petkov.

Fix intendation in cdrom_decode_status(), no real code changes.

While at it:
- beautify comments

There should be no functional changes caused by this patch.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarBorislav Petkov <petkovbb@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 1920c48d
...@@ -311,7 +311,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) ...@@ -311,7 +311,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct request *rq = hwif->rq; struct request *rq = hwif->rq;
int err, sense_key; int err, sense_key, do_end_request = 0;
u8 quiet = rq->cmd_flags & REQ_QUIET; u8 quiet = rq->cmd_flags & REQ_QUIET;
/* get the IDE error register */ /* get the IDE error register */
...@@ -330,13 +330,9 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) ...@@ -330,13 +330,9 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
*/ */
rq->cmd_flags |= REQ_FAILED; rq->cmd_flags |= REQ_FAILED;
return 2; return 2;
} else { }
int do_end_request = 0;
/* /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */
* if we have an error, pass back CHECK_CONDITION as the
* scsi status byte
*/
if (blk_pc_request(rq) && !rq->errors) if (blk_pc_request(rq) && !rq->errors)
rq->errors = SAM_STAT_CHECK_CONDITION; rq->errors = SAM_STAT_CHECK_CONDITION;
...@@ -345,8 +341,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) ...@@ -345,8 +341,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
switch (sense_key) { switch (sense_key) {
case NOT_READY: case NOT_READY:
if (blk_fs_request(rq) == 0 || if (blk_fs_request(rq) == 0 || rq_data_dir(rq) == READ) {
rq_data_dir(rq) == READ) {
cdrom_saw_media_change(drive); cdrom_saw_media_change(drive);
if (blk_fs_request(rq) && !quiet) if (blk_fs_request(rq) && !quiet)
...@@ -363,19 +358,20 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) ...@@ -363,19 +358,20 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
if (blk_fs_request(rq) == 0) if (blk_fs_request(rq) == 0)
return 0; return 0;
/* /*
* Arrange to retry the request but be sure to give up * Arrange to retry the request but be sure to give up if we've
* if we've retried too many times. * retried too many times.
*/ */
if (++rq->errors > ERROR_MAX) if (++rq->errors > ERROR_MAX)
do_end_request = 1; do_end_request = 1;
break; break;
case ILLEGAL_REQUEST: case ILLEGAL_REQUEST:
/* /*
* Don't print error message for this condition-- * Don't print error message for this condition -- SFF8090i
* SFF8090i indicates that 5/24/00 is the correct * indicates that 5/24/00 is the correct response to a request
* response to a request to close the tray if the * to close the tray if the drive doesn't have that capability.
* drive doesn't have that capability. *
* cdrom_log_sense() knows this! * cdrom_log_sense() knows this!
*/ */
if (rq->cmd[0] == GPCMD_START_STOP_UNIT) if (rq->cmd[0] == GPCMD_START_STOP_UNIT)
...@@ -392,8 +388,8 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) ...@@ -392,8 +388,8 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
break; break;
case MEDIUM_ERROR: case MEDIUM_ERROR:
/* /*
* No point in re-trying a zillion times on a bad * No point in re-trying a zillion times on a bad sector.
* sector. If we got here the error is not correctable. * If we got here the error is not correctable.
*/ */
if (!quiet) if (!quiet)
ide_dump_status(drive, "media error " ide_dump_status(drive, "media error "
...@@ -401,7 +397,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) ...@@ -401,7 +397,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
do_end_request = 1; do_end_request = 1;
break; break;
case BLANK_CHECK: case BLANK_CHECK:
/* disk appears blank ?? */ /* disk appears blank? */
if (!quiet) if (!quiet)
ide_dump_status(drive, "media error (blank)", ide_dump_status(drive, "media error (blank)",
stat); stat);
...@@ -425,21 +421,16 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) ...@@ -425,21 +421,16 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
} }
/* /*
* End a request through request sense analysis when we have * End a request through request sense analysis when we have sense data.
* sense data. We need this in order to perform end of media * We need this in order to perform end of media processing.
* processing.
*/ */
if (do_end_request) if (do_end_request)
goto end_request; goto end_request;
/* /* if we got a CHECK_CONDITION status, queue a request sense command */
* If we got a CHECK_CONDITION status, queue
* a request sense command.
*/
if (stat & ATA_ERR) if (stat & ATA_ERR)
cdrom_queue_request_sense(drive, NULL, NULL); cdrom_queue_request_sense(drive, NULL, NULL);
return 1; return 1;
}
end_request: end_request:
if (stat & ATA_ERR) { if (stat & ATA_ERR) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment