ide: add ide_read_error() inline helper
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Wed, 6 Feb 2008 01:57:51 +0000 (02:57 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Wed, 6 Feb 2008 01:57:51 +0000 (02:57 +0100)
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-cd.c
drivers/ide/ide-floppy.c
drivers/ide/ide-io.c
drivers/ide/ide-iops.c
drivers/ide/ide-lib.c
drivers/ide/ide-tape.c
drivers/ide/ide-taskfile.c
include/linux/ide.h

index 892e42e80a3282befbc7980dfd687d0f96442d24..5e42c19a03e3b7f9e2eec932a929660cb513730d 100644 (file)
@@ -304,7 +304,7 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
                return 0;
 
        /* Get the IDE error register. */
-       err = HWIF(drive)->INB(IDE_ERROR_REG);
+       err = ide_read_error(drive);
        sense_key = err >> 4;
 
        if (rq == NULL) {
index 3ac79ed2bc633e008c184723855e5fe1b4a7fcd8..faf22d716f805995e6e59351c77e740b514f4fce 100644 (file)
@@ -465,7 +465,7 @@ static void idefloppy_retry_pc(ide_drive_t *drive)
        idefloppy_pc_t *pc;
        struct request *rq;
 
-       (void)drive->hwif->INB(IDE_ERROR_REG);
+       (void)ide_read_error(drive);
        pc = idefloppy_next_pc_storage(drive);
        rq = idefloppy_next_rq_storage(drive);
        idefloppy_create_request_sense_cmd(pc);
index 29cb043a2d3a98b6ec65eb9b3fd7c4e4d4fc0d8c..3addbe478d26743701ba669c4ae6acf5b2050725 100644 (file)
@@ -821,8 +821,8 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
 #ifdef DEBUG
        printk("%s: DRIVE_CMD (null)\n", drive->name);
 #endif
-       ide_end_drive_cmd(drive, ide_read_status(drive),
-                       hwif->INB(IDE_ERROR_REG));
+       ide_end_drive_cmd(drive, ide_read_status(drive), ide_read_error(drive));
+
        return ide_stopped;
 }
 
index 716244c45211e93964ee3ad77ae80de1912bffd8..c32e759df2089a5229f211154f0642da5e6e3fed 100644 (file)
@@ -918,7 +918,9 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
                drive->failures++;
        } else  {
                printk("%s: reset: ", hwif->name);
-               if ((tmp = hwif->INB(IDE_ERROR_REG)) == 1) {
+               tmp = ide_read_error(drive);
+
+               if (tmp == 1) {
                        printk("success\n");
                        drive->failures = 0;
                } else {
index b42940d8bf70e68661412ba554967f9b8f160737..1ff676cc6473f56dd9a5cc00b7f31d57c4899e4d 100644 (file)
@@ -578,7 +578,7 @@ u8 ide_dump_status(ide_drive_t *drive, const char *msg, u8 stat)
        }
        printk("}\n");
        if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
-               err = drive->hwif->INB(IDE_ERROR_REG);
+               err = ide_read_error(drive);
                printk("%s: %s: error=0x%02x ", drive->name, msg, err);
                if (drive->media == ide_disk)
                        ide_dump_ata_error(drive, err);
index 66801c084dd814588a993a5e07083dad4819d5a9..401731302c5ceb24df5069cf980801da02ff26fa 100644 (file)
@@ -1125,7 +1125,7 @@ static ide_startstop_t idetape_retry_pc (ide_drive_t *drive)
        idetape_pc_t *pc;
        struct request *rq;
 
-       (void)drive->hwif->INB(IDE_ERROR_REG);
+       (void)ide_read_error(drive);
        pc = idetape_next_pc_storage(drive);
        rq = idetape_next_rq_storage(drive);
        idetape_create_request_sense_cmd(pc);
index 2545dde6ee02210e0b1474e7f7f37b3585069b2e..0518a2e948cf46f9317f8ef27e4a4121c6df08ae 100644 (file)
@@ -241,7 +241,6 @@ static ide_startstop_t recal_intr(ide_drive_t *drive)
 static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
 {
        ide_task_t *args        = HWGROUP(drive)->rq->special;
-       ide_hwif_t *hwif        = HWIF(drive);
        u8 stat;
 
        local_irq_enable_in_hardirq();
@@ -252,7 +251,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
                /* calls ide_end_drive_cmd */
 
        if (args)
-               ide_end_drive_cmd(drive, stat, hwif->INB(IDE_ERROR_REG));
+               ide_end_drive_cmd(drive, stat, ide_read_error(drive));
 
        return ide_stopped;
 }
@@ -408,7 +407,7 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
 void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
 {
        if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
-               u8 err = drive->hwif->INB(IDE_ERROR_REG);
+               u8 err = ide_read_error(drive);
 
                ide_end_drive_cmd(drive, stat, err);
                return;
index d2124920ff10b5c58d6d6150fa9f35acc32eb2fb..acec99da832dc475a44aa1e18696f84e1dae1f53 100644 (file)
@@ -1323,4 +1323,11 @@ static inline u8 ide_read_altstatus(ide_drive_t *drive)
        return hwif->INB(hwif->io_ports[IDE_CONTROL_OFFSET]);
 }
 
+static inline u8 ide_read_error(ide_drive_t *drive)
+{
+       ide_hwif_t *hwif = drive->hwif;
+
+       return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]);
+}
+
 #endif /* _IDE_H */