]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ide: use ->end_request only for private device driver requests
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 27 Mar 2009 11:46:34 +0000 (12:46 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 27 Mar 2009 11:46:34 +0000 (12:46 +0100)
* Move IDE{FLOPPY,TAPE}_ERROR_* defines to <linux/ide.h> and rename them
  to IDE_DRV_ERROR_*.

* Handle ->end_request special cases for floppy/tape media in ide_kill_rq().

* Call ->end_request only for private device driver requests.

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

index f9ad4b3021ee885348c192917d85c91cb0261092..fb235641da33327f925f4ab57612049fb194f142 100644 (file)
@@ -61,9 +61,6 @@
  */
 #define IDEFLOPPY_PC_DELAY     (HZ/20) /* default delay for ZIP 100 (50ms) */
 
-/* Error code returned in rq->errors to the higher part of the driver. */
-#define        IDEFLOPPY_ERROR_GENERAL         101
-
 /*
  * Used to finish servicing a request. For read/write requests, we will call
  * ide_end_request to pass to the next buffer.
@@ -77,7 +74,7 @@ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
 
        switch (uptodate) {
        case 0:
-               error = IDEFLOPPY_ERROR_GENERAL;
+               error = IDE_DRV_ERROR_GENERAL;
                break;
 
        case 1:
@@ -183,7 +180,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
                if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR))
                        ide_floppy_report_error(floppy, pc);
                /* Giving up */
-               pc->error = IDEFLOPPY_ERROR_GENERAL;
+               pc->error = IDE_DRV_ERROR_GENERAL;
 
                drive->failed_pc = NULL;
                drive->pc_callback(drive, 0);
index 38076169b89308d0a9a0c5e284e385f4af4a1768..da2f97dfa8f8d2ee729d1ff6d2b5605dc924aade 100644 (file)
@@ -178,7 +178,12 @@ EXPORT_SYMBOL(ide_complete_rq);
 
 void ide_kill_rq(ide_drive_t *drive, struct request *rq)
 {
-       if (rq->rq_disk) {
+       drive->failed_pc = NULL;
+
+       if (drive->media == ide_tape)
+               rq->errors = IDE_DRV_ERROR_GENERAL;
+
+       if (blk_special_request(rq) && rq->rq_disk) {
                struct ide_driver *drv;
 
                drv = *(struct ide_driver **)rq->rq_disk->private_data;
index d6555984ee887093adf7944745fd6bd04c10a593..e3b4c1c39d378b793267c04142d97f35e33dd77f 100644 (file)
@@ -152,11 +152,6 @@ struct idetape_bh {
 #define IDETAPE_LU_RETENSION_MASK      2
 #define IDETAPE_LU_EOT_MASK            4
 
-/* Error codes returned in rq->errors to the higher part of the driver. */
-#define IDETAPE_ERROR_GENERAL          101
-#define IDETAPE_ERROR_FILEMARK         102
-#define IDETAPE_ERROR_EOD              103
-
 /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */
 #define IDETAPE_BLOCK_DESCRIPTOR       0
 #define IDETAPE_CAPABILITIES_PAGE      0x2a
@@ -422,19 +417,19 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
                }
        }
        if (pc->c[0] == READ_6 && (sense[2] & 0x80)) {
-               pc->error = IDETAPE_ERROR_FILEMARK;
+               pc->error = IDE_DRV_ERROR_FILEMARK;
                pc->flags |= PC_FLAG_ABORT;
        }
        if (pc->c[0] == WRITE_6) {
                if ((sense[2] & 0x40) || (tape->sense_key == 0xd
                     && tape->asc == 0x0 && tape->ascq == 0x2)) {
-                       pc->error = IDETAPE_ERROR_EOD;
+                       pc->error = IDE_DRV_ERROR_EOD;
                        pc->flags |= PC_FLAG_ABORT;
                }
        }
        if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) {
                if (tape->sense_key == 8) {
-                       pc->error = IDETAPE_ERROR_EOD;
+                       pc->error = IDE_DRV_ERROR_EOD;
                        pc->flags |= PC_FLAG_ABORT;
                }
                if (!(pc->flags & PC_FLAG_ABORT) &&
@@ -474,7 +469,7 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
        debug_log(DBG_PROCS, "Enter %s\n", __func__);
 
        switch (uptodate) {
-       case 0: error = IDETAPE_ERROR_GENERAL; break;
+       case 0: error = IDE_DRV_ERROR_GENERAL; break;
        case 1: error = 0; break;
        default: error = uptodate;
        }
@@ -669,7 +664,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
                                                tape->ascq);
                        }
                        /* Giving up */
-                       pc->error = IDETAPE_ERROR_GENERAL;
+                       pc->error = IDE_DRV_ERROR_GENERAL;
                }
                drive->failed_pc = NULL;
                drive->pc_callback(drive, 0);
@@ -730,7 +725,7 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
                }
                pc->error = 0;
        } else {
-               pc->error = IDETAPE_ERROR_GENERAL;
+               pc->error = IDE_DRV_ERROR_GENERAL;
                drive->failed_pc = NULL;
        }
        drive->pc_callback(drive, 0);
@@ -1210,7 +1205,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks,
 
        if (tape->merge_bh)
                idetape_init_merge_buffer(tape);
-       if (errors == IDETAPE_ERROR_GENERAL)
+       if (errors == IDE_DRV_ERROR_GENERAL)
                return -EIO;
        return ret;
 }
index 7237e1547b1fb5ca8d60b344102043fa688f6226..f85b7f21a617d6c24acca2530001a874825907ad 100644 (file)
@@ -315,12 +315,8 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
                        break;
                }
 
-               if (sectors > 0) {
-                       struct ide_driver *drv;
-
-                       drv = *(struct ide_driver **)rq->rq_disk->private_data;
-                       drv->end_request(drive, 1, sectors);
-               }
+               if (sectors > 0)
+                       ide_end_request(drive, 1, sectors);
        }
        return ide_error(drive, s, stat);
 }
@@ -337,13 +333,7 @@ void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
                return;
        }
 
-       if (rq->rq_disk) {
-               struct ide_driver *drv;
-
-               drv = *(struct ide_driver **)rq->rq_disk->private_data;;
-               drv->end_request(drive, 1, rq->nr_sectors);
-       } else
-               ide_end_request(drive, 1, rq->nr_sectors);
+       ide_end_request(drive, 1, rq->nr_sectors);
 }
 
 /*
index 4a904681f3e42556ac830866059482297bb61698..aece06a4930f3accc0dd72fc5bed29a87383b669 100644 (file)
 #define ERROR_RESET    3       /* Reset controller every 4th retry */
 #define ERROR_RECAL    1       /* Recalibrate every 2nd retry */
 
+/* Error codes returned in rq->errors to the higher part of the driver. */
+enum {
+       IDE_DRV_ERROR_GENERAL   = 101,
+       IDE_DRV_ERROR_FILEMARK  = 102,
+       IDE_DRV_ERROR_EOD       = 103,
+};
+
 /*
  * Definitions for accessing IDE controller registers
  */