]> Pileus Git - ~andy/linux/commitdiff
ide: return request status from ->pc_callback method
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 27 Mar 2009 11:46:36 +0000 (12:46 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 27 Mar 2009 11:46:36 +0000 (12:46 +0100)
Make ->pc_callback method return request status and then move
the request completion from ->pc_callback to ide_pc_intr().

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>
drivers/ide/ide-atapi.c
drivers/ide/ide-floppy.c
drivers/ide/ide-tape.c
include/linux/ide.h

index f44474b0adaeed065000075378ed8f38f9a40454..f72b5a67543596ffc813de5f48542ba94238ee2a 100644 (file)
@@ -357,6 +357,8 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
 
        /* No more interrupts */
        if ((stat & ATA_DRQ) == 0) {
+               int uptodate;
+
                debug_log("Packet command completed, %d bytes transferred\n",
                          pc->xferred);
 
@@ -395,7 +397,15 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
                        dsc = 1;
 
                /* Command finished - Call the callback function */
-               drive->pc_callback(drive, dsc);
+               uptodate = drive->pc_callback(drive, dsc);
+
+               if (uptodate == 0)
+                       drive->failed_pc = NULL;
+
+               if (blk_special_request(rq))
+                       ide_complete_rq(drive, 0);
+               else
+                       ide_end_request(drive, uptodate, 0);
 
                return ide_stopped;
        }
index ab870a08d62b698f3ab98d7c7b3b9b78aa059c8d..5625946739addf7053d41e3a3caa37acc4aa56e7 100644 (file)
@@ -71,7 +71,7 @@ static void idefloppy_update_buffers(ide_drive_t *drive,
                ide_end_request(drive, 1, 0);
 }
 
-static void ide_floppy_callback(ide_drive_t *drive, int dsc)
+static int ide_floppy_callback(ide_drive_t *drive, int dsc)
 {
        struct ide_disk_obj *floppy = drive->driver_data;
        struct ide_atapi_pc *pc = drive->pc;
@@ -108,14 +108,10 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
                               "Aborting request!\n");
        }
 
-       if (uptodate == 0)
-               drive->failed_pc = NULL;
-
-       if (blk_special_request(rq)) {
+       if (blk_special_request(rq))
                rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
-               ide_complete_rq(drive, 0);
-       } else
-               ide_end_request(drive, uptodate, 0);
+
+       return uptodate;
 }
 
 static void ide_floppy_report_error(struct ide_disk_obj *floppy,
index fc61bbef3bb940a78e088eaf75e31240ea4f7a15..a42e49c6cc3f36951737ff44ed9affbee891f6ba 100644 (file)
@@ -463,7 +463,7 @@ static void ide_tape_kfree_buffer(idetape_tape_t *tape)
 
 static void ide_tape_handle_dsc(ide_drive_t *);
 
-static void ide_tape_callback(ide_drive_t *drive, int dsc)
+static int ide_tape_callback(ide_drive_t *drive, int dsc)
 {
        idetape_tape_t *tape = drive->driver_data;
        struct ide_atapi_pc *pc = drive->pc;
@@ -530,13 +530,7 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc)
 
        rq->errors = err;
 
-       if (uptodate == 0)
-               drive->failed_pc = NULL;
-
-       if (blk_special_request(rq))
-               ide_complete_rq(drive, 0);
-       else
-               ide_end_request(drive, uptodate, 0);
+       return uptodate;
 }
 
 /*
index c2cdf77501853c8784d8f16e81b735c61a197f99..9127d87cfa93385034c8d99cf4fe2c65c136f346 100644 (file)
@@ -619,7 +619,7 @@ struct ide_drive_s {
        struct ide_atapi_pc *failed_pc;
 
        /* callback for packet commands */
-       void (*pc_callback)(struct ide_drive_s *, int);
+       int  (*pc_callback)(struct ide_drive_s *, int);
 
        void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
        int  (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,