aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:34 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:34 -0400
commit313afea7f25cc6d420179e0b316499c164e3e372 (patch)
tree573be1b3912d970951ba30c718332c6174ac8144 /drivers/ide/ide-tape.c
parentc152cc1a90f9680cefa74d9ff9ce36038081ba72 (diff)
ide-{floppy,tape}: cleanup ide*_end_request()
* ide*_end_request() is only called with uptodate == 0 or uptodate == 1 so cleanup it accordingly. * Inline ide*_end_request() content at call sites so the only user left is ->end_request method. * ->end_request is now used only for private driver requests so remove handling of other requests from ide*_end_request(). There should be no functional changes caused by this patch. Acked-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r--drivers/ide/ide-tape.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index e3b4c1c39d37..35469f3069a2 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -464,23 +464,13 @@ static void ide_tape_kfree_buffer(idetape_tape_t *tape)
464static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) 464static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
465{ 465{
466 struct request *rq = drive->hwif->rq; 466 struct request *rq = drive->hwif->rq;
467 int error;
468 467
469 debug_log(DBG_PROCS, "Enter %s\n", __func__); 468 debug_log(DBG_PROCS, "Enter %s\n", __func__);
470 469
471 switch (uptodate) { 470 rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
472 case 0: error = IDE_DRV_ERROR_GENERAL; break;
473 case 1: error = 0; break;
474 default: error = uptodate;
475 }
476 rq->errors = error;
477 if (error)
478 drive->failed_pc = NULL;
479 471
480 if (!blk_special_request(rq)) { 472 if (uptodate == 0)
481 ide_end_request(drive, uptodate, nr_sects); 473 drive->failed_pc = NULL;
482 return 0;
483 }
484 474
485 ide_complete_rq(drive, 0); 475 ide_complete_rq(drive, 0);
486 476
@@ -493,7 +483,9 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc)
493{ 483{
494 idetape_tape_t *tape = drive->driver_data; 484 idetape_tape_t *tape = drive->driver_data;
495 struct ide_atapi_pc *pc = drive->pc; 485 struct ide_atapi_pc *pc = drive->pc;
486 struct request *rq = drive->hwif->rq;
496 int uptodate = pc->error ? 0 : 1; 487 int uptodate = pc->error ? 0 : 1;
488 int err = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
497 489
498 debug_log(DBG_PROCS, "Enter %s\n", __func__); 490 debug_log(DBG_PROCS, "Enter %s\n", __func__);
499 491
@@ -510,7 +502,6 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc)
510 printk(KERN_ERR "ide-tape: Error in REQUEST SENSE " 502 printk(KERN_ERR "ide-tape: Error in REQUEST SENSE "
511 "itself - Aborting request!\n"); 503 "itself - Aborting request!\n");
512 } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { 504 } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) {
513 struct request *rq = drive->hwif->rq;
514 int blocks = pc->xferred / tape->blk_size; 505 int blocks = pc->xferred / tape->blk_size;
515 506
516 tape->avg_size += blocks * tape->blk_size; 507 tape->avg_size += blocks * tape->blk_size;
@@ -525,8 +516,10 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc)
525 tape->first_frame += blocks; 516 tape->first_frame += blocks;
526 rq->current_nr_sectors -= blocks; 517 rq->current_nr_sectors -= blocks;
527 518
528 if (pc->error) 519 if (pc->error) {
529 uptodate = pc->error; 520 uptodate = 0;
521 err = pc->error;
522 }
530 } else if (pc->c[0] == READ_POSITION && uptodate) { 523 } else if (pc->c[0] == READ_POSITION && uptodate) {
531 u8 *readpos = pc->buf; 524 u8 *readpos = pc->buf;
532 525
@@ -540,6 +533,7 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc)
540 "to the tape\n"); 533 "to the tape\n");
541 clear_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags); 534 clear_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags);
542 uptodate = 0; 535 uptodate = 0;
536 err = IDE_DRV_ERROR_GENERAL;
543 } else { 537 } else {
544 debug_log(DBG_SENSE, "Block Location - %u\n", 538 debug_log(DBG_SENSE, "Block Location - %u\n",
545 be32_to_cpup((__be32 *)&readpos[4])); 539 be32_to_cpup((__be32 *)&readpos[4]));
@@ -550,7 +544,15 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc)
550 } 544 }
551 } 545 }
552 546
553 idetape_end_request(drive, uptodate, 0); 547 rq->errors = err;
548
549 if (uptodate == 0)
550 drive->failed_pc = NULL;
551
552 if (blk_special_request(rq))
553 ide_complete_rq(drive, 0);
554 else
555 ide_end_request(drive, uptodate, 0);
554} 556}
555 557
556/* 558/*
@@ -794,7 +796,9 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
794 if (rq != postponed_rq) { 796 if (rq != postponed_rq) {
795 printk(KERN_ERR "ide-tape: ide-tape.c bug - " 797 printk(KERN_ERR "ide-tape: ide-tape.c bug - "
796 "Two DSC requests were queued\n"); 798 "Two DSC requests were queued\n");
797 idetape_end_request(drive, 0, 0); 799 rq->errors = IDE_DRV_ERROR_GENERAL;
800 drive->failed_pc = NULL;
801 ide_complete_rq(drive, 0);
798 return ide_stopped; 802 return ide_stopped;
799 } 803 }
800 804