diff options
-rw-r--r-- | drivers/ide/ide-cd.c | 69 |
1 files changed, 24 insertions, 45 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 43db330d7b5d..ffbaa6d578ff 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -330,8 +330,8 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
330 | */ | 330 | */ |
331 | rq->cmd_flags |= REQ_FAILED; | 331 | rq->cmd_flags |= REQ_FAILED; |
332 | return 2; | 332 | return 2; |
333 | } else if (blk_pc_request(rq) || rq->cmd_type == REQ_TYPE_ATA_PC) { | 333 | } else { |
334 | /* All other functions, except for READ. */ | 334 | int do_end_request = 0; |
335 | 335 | ||
336 | /* | 336 | /* |
337 | * if we have an error, pass back CHECK_CONDITION as the | 337 | * if we have an error, pass back CHECK_CONDITION as the |
@@ -340,53 +340,16 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
340 | if (blk_pc_request(rq) && !rq->errors) | 340 | if (blk_pc_request(rq) && !rq->errors) |
341 | rq->errors = SAM_STAT_CHECK_CONDITION; | 341 | rq->errors = SAM_STAT_CHECK_CONDITION; |
342 | 342 | ||
343 | switch (sense_key) { | ||
344 | case NOT_READY: | ||
345 | cdrom_saw_media_change(drive); | ||
346 | break; | ||
347 | case UNIT_ATTENTION: | ||
348 | cdrom_saw_media_change(drive); | ||
349 | return 0; | ||
350 | case ILLEGAL_REQUEST: | ||
351 | /* | ||
352 | * Don't print error message for this condition-- | ||
353 | * SFF8090i indicates that 5/24/00 is the correct | ||
354 | * response to a request to close the tray if the | ||
355 | * drive doesn't have that capability. | ||
356 | * cdrom_log_sense() knows this! | ||
357 | */ | ||
358 | if (rq->cmd[0] == GPCMD_START_STOP_UNIT) | ||
359 | break; | ||
360 | /* fall-through */ | ||
361 | default: | ||
362 | if (!quiet) | ||
363 | ide_dump_status(drive, "packet command error", | ||
364 | stat); | ||
365 | } | ||
366 | |||
367 | rq->cmd_flags |= REQ_FAILED; | ||
368 | |||
369 | /* | ||
370 | * instead of playing games with moving completions around, | ||
371 | * remove failed request completely and end it when the | ||
372 | * request sense has completed | ||
373 | */ | ||
374 | goto end_request; | ||
375 | |||
376 | } else if (blk_fs_request(rq)) { | ||
377 | int do_end_request = 0; | ||
378 | |||
379 | /* handle errors from READ and WRITE requests */ | ||
380 | |||
381 | if (blk_noretry_request(rq)) | 343 | if (blk_noretry_request(rq)) |
382 | do_end_request = 1; | 344 | do_end_request = 1; |
383 | 345 | ||
384 | switch (sense_key) { | 346 | switch (sense_key) { |
385 | case NOT_READY: | 347 | case NOT_READY: |
386 | if (rq_data_dir(rq) == READ) { | 348 | if (blk_fs_request(rq) == 0 || |
349 | rq_data_dir(rq) == READ) { | ||
387 | cdrom_saw_media_change(drive); | 350 | cdrom_saw_media_change(drive); |
388 | 351 | ||
389 | if (!quiet) | 352 | if (blk_fs_request(rq) && !quiet) |
390 | printk(KERN_ERR PFX "%s: tray open\n", | 353 | printk(KERN_ERR PFX "%s: tray open\n", |
391 | drive->name); | 354 | drive->name); |
392 | } else { | 355 | } else { |
@@ -398,6 +361,8 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
398 | case UNIT_ATTENTION: | 361 | case UNIT_ATTENTION: |
399 | cdrom_saw_media_change(drive); | 362 | cdrom_saw_media_change(drive); |
400 | 363 | ||
364 | if (blk_fs_request(rq) == 0) | ||
365 | return 0; | ||
401 | /* | 366 | /* |
402 | * Arrange to retry the request but be sure to give up | 367 | * Arrange to retry the request but be sure to give up |
403 | * if we've retried too many times. | 368 | * if we've retried too many times. |
@@ -406,6 +371,16 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
406 | do_end_request = 1; | 371 | do_end_request = 1; |
407 | break; | 372 | break; |
408 | case ILLEGAL_REQUEST: | 373 | case ILLEGAL_REQUEST: |
374 | /* | ||
375 | * Don't print error message for this condition-- | ||
376 | * SFF8090i indicates that 5/24/00 is the correct | ||
377 | * response to a request to close the tray if the | ||
378 | * drive doesn't have that capability. | ||
379 | * cdrom_log_sense() knows this! | ||
380 | */ | ||
381 | if (rq->cmd[0] == GPCMD_START_STOP_UNIT) | ||
382 | break; | ||
383 | /* fall-through */ | ||
409 | case DATA_PROTECT: | 384 | case DATA_PROTECT: |
410 | /* | 385 | /* |
411 | * No point in retrying after an illegal request or data | 386 | * No point in retrying after an illegal request or data |
@@ -433,6 +408,8 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
433 | do_end_request = 1; | 408 | do_end_request = 1; |
434 | break; | 409 | break; |
435 | default: | 410 | default: |
411 | if (blk_fs_request(rq) == 0) | ||
412 | break; | ||
436 | if (err & ~ATA_ABORTED) { | 413 | if (err & ~ATA_ABORTED) { |
437 | /* go to the default handler for other errors */ | 414 | /* go to the default handler for other errors */ |
438 | ide_error(drive, "cdrom_decode_status", stat); | 415 | ide_error(drive, "cdrom_decode_status", stat); |
@@ -442,6 +419,11 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
442 | do_end_request = 1; | 419 | do_end_request = 1; |
443 | } | 420 | } |
444 | 421 | ||
422 | if (blk_fs_request(rq) == 0) { | ||
423 | rq->cmd_flags |= REQ_FAILED; | ||
424 | do_end_request = 1; | ||
425 | } | ||
426 | |||
445 | /* | 427 | /* |
446 | * End a request through request sense analysis when we have | 428 | * End a request through request sense analysis when we have |
447 | * sense data. We need this in order to perform end of media | 429 | * sense data. We need this in order to perform end of media |
@@ -457,9 +439,6 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
457 | if (stat & ATA_ERR) | 439 | if (stat & ATA_ERR) |
458 | cdrom_queue_request_sense(drive, NULL, NULL); | 440 | cdrom_queue_request_sense(drive, NULL, NULL); |
459 | return 1; | 441 | return 1; |
460 | } else { | ||
461 | blk_dump_rq_flags(rq, PFX "bad rq"); | ||
462 | return 2; | ||
463 | } | 442 | } |
464 | 443 | ||
465 | end_request: | 444 | end_request: |