]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ide: pass error value to ide_complete_rq()
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 27 Mar 2009 11:46:43 +0000 (12:46 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 27 Mar 2009 11:46:43 +0000 (12:46 +0100)
Set rq->errors at ide_complete_rq() call sites and then pass
error value to ide_complete_rq().

[ Some rq->errors assignments look really wrong but this patch
  leaves them alone to not introduce too many changes at once. ]

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-atapi.c
drivers/ide/ide-eh.c
drivers/ide/ide-floppy.c
drivers/ide/ide-io.c
drivers/ide/ide-tape.c
drivers/ide/ide-taskfile.c
include/linux/ide.h

index 92c6ef6feb57ec5ef17b765871d92f602b9c0f7b..5d57af29c4c87410682c51860f06fa0ceae97937 100644 (file)
@@ -402,9 +402,10 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
                if (uptodate == 0)
                        drive->failed_pc = NULL;
 
-               if (blk_special_request(rq))
+               if (blk_special_request(rq)) {
+                       rq->errors = 0;
                        ide_complete_rq(drive, 0);
-               else
+               else
                        ide_end_request(drive, uptodate, 0);
 
                return ide_stopped;
index f6e1a82a3cc5f8f65cb936b19b6ca761a542ea3a..d1385d332e94501d2e13677b15c902916c24b66f 100644 (file)
@@ -123,17 +123,18 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat)
 
        /* retry only "normal" I/O: */
        if (!blk_fs_request(rq)) {
-               rq->errors = 1;
                if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
                        struct ide_cmd *cmd = rq->special;
 
                        if (cmd)
                                ide_complete_cmd(drive, cmd, stat, err);
                } else if (blk_pm_request(rq)) {
+                       rq->errors = 1;
                        ide_complete_pm_rq(drive, rq);
                        return ide_stopped;
                }
-               ide_complete_rq(drive, err);
+               rq->errors = err;
+               ide_complete_rq(drive, err ? -EIO : 0);
                return ide_stopped;
        }
 
index f56e9a918b99354bc53e65ac46e9940a972b5340..407e4914dfd1d601aa76ce2c5170b6f693560b09 100644 (file)
@@ -260,7 +260,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
                        printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
 
                if (blk_special_request(rq)) {
-                       rq->errors = IDE_DRV_ERROR_GENERAL;
+                       rq->errors = 0;
                        ide_complete_rq(drive, 0);
                        return ide_stopped;
                } else
index c38426de6041e1f35cec3867e9bdfd12b6000b88..4cc2bb13f1d60f07b6e06a82400d7f5f2ccbcb21 100644 (file)
@@ -144,17 +144,14 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
                kfree(cmd);
 }
 
-void ide_complete_rq(ide_drive_t *drive, u8 err)
+void ide_complete_rq(ide_drive_t *drive, int error)
 {
        ide_hwif_t *hwif = drive->hwif;
        struct request *rq = hwif->rq;
 
        hwif->rq = NULL;
 
-       rq->errors = err;
-
-       if (unlikely(blk_end_request(rq, (rq->errors ? -EIO : 0),
-                                    blk_rq_bytes(rq))))
+       if (unlikely(blk_end_request(rq, error, blk_rq_bytes(rq))))
                BUG();
 }
 EXPORT_SYMBOL(ide_complete_rq);
@@ -166,13 +163,14 @@ void ide_kill_rq(ide_drive_t *drive, struct request *rq)
 
        drive->failed_pc = NULL;
 
-       if ((media == ide_floppy && drv_req) || media == ide_tape)
-               rq->errors = IDE_DRV_ERROR_GENERAL;
-
-       if ((media == ide_floppy || media == ide_tape) && drv_req)
+       if ((media == ide_floppy || media == ide_tape) && drv_req) {
+               rq->errors = 0;
                ide_complete_rq(drive, 0);
-       else
+       } else {
+               if (media == ide_tape)
+                       rq->errors = IDE_DRV_ERROR_GENERAL;
                ide_end_request(drive, 0, 0);
+       }
 }
 
 static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf)
@@ -312,6 +310,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
 #ifdef DEBUG
        printk("%s: DRIVE_CMD (null)\n", drive->name);
 #endif
+       rq->errors = 0;
        ide_complete_rq(drive, 0);
 
        return ide_stopped;
index a42e49c6cc3f36951737ff44ed9affbee891f6ba..3bfcd7290ce01a080cc837450ef35ffc1b07f75a 100644 (file)
@@ -774,8 +774,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
                if (rq != postponed_rq) {
                        printk(KERN_ERR "ide-tape: ide-tape.c bug - "
                                        "Two DSC requests were queued\n");
-                       rq->errors = IDE_DRV_ERROR_GENERAL;
                        drive->failed_pc = NULL;
+                       rq->errors = 0;
                        ide_complete_rq(drive, 0);
                        return ide_stopped;
                }
index f99a6aaad9eb4d42b07c9420b66a2d4999245882..e9d008ef3f33d01e8b9865ae80a3b442d7f13856 100644 (file)
@@ -289,10 +289,12 @@ static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
 
 void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat)
 {
+       struct request *rq = drive->hwif->rq;
        u8 err = ide_read_error(drive);
 
        ide_complete_cmd(drive, cmd, stat, err);
-       ide_complete_rq(drive, err);
+       rq->errors = err;
+       ide_complete_rq(drive, err ? -EIO : 0);
 }
 
 /*
index f910f4ccfaa045996f3f34b48d3c3563cc9f1a5c..32369d5797de7eacae1f0e295a89c59558700908 100644 (file)
@@ -1166,7 +1166,7 @@ extern int ide_devset_execute(ide_drive_t *drive,
                              const struct ide_devset *setting, int arg);
 
 void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8);
-void ide_complete_rq(ide_drive_t *, u8);
+void ide_complete_rq(ide_drive_t *, int);
 
 void ide_tf_dump(const char *, struct ide_taskfile *);