]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ide: add ide_set_irq() inline helper
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Jan 2008 19:13:08 +0000 (20:13 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Jan 2008 19:13:08 +0000 (20:13 +0100)
There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-io.c
drivers/ide/ide-iops.c
drivers/ide/ide-probe.c
drivers/ide/ide-taskfile.c
include/linux/ide.h

index e37b09c81e3a5d6e1b55bfa854f33c6a75e3a03b..5b213dcaa5e6320071813a62373a0b7630176421 100644 (file)
@@ -939,8 +939,7 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
                if (rc)
                        printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name);
                SELECT_DRIVE(drive);
-               if (IDE_CONTROL_REG)
-                       HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
+               ide_set_irq(drive, 1);
                rc = ide_wait_not_busy(HWIF(drive), 100000);
                if (rc)
                        printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
@@ -1213,15 +1212,13 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
                }
        again:
                hwif = HWIF(drive);
-               if (hwgroup->hwif->sharing_irq &&
-                   hwif != hwgroup->hwif &&
-                   hwif->io_ports[IDE_CONTROL_OFFSET]) {
+               if (hwgroup->hwif->sharing_irq && hwif != hwgroup->hwif) {
                        /*
                         * set nIEN for previous hwif, drives in the
                         * quirk_list may not like intr setups/cleanups
                         */
                        if (drive->quirk_list != 1)
-                               hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
+                               ide_set_irq(drive, 0);
                }
                hwgroup->hwif = hwif;
                hwgroup->drive = drive;
index 595a5cef41a2b9f58dd3e2ea32f7c09ca64a2cfe..a26c9ca784a6321f431dcd8c25512fb3c8d445d7 100644 (file)
@@ -688,8 +688,7 @@ int ide_driveid_update(ide_drive_t *drive)
         */
 
        SELECT_MASK(drive, 1);
-       if (IDE_CONTROL_REG)
-               hwif->OUTB(drive->ctl,IDE_CONTROL_REG);
+       ide_set_irq(drive, 1);
        msleep(50);
        hwif->OUTB(WIN_IDENTIFY, IDE_COMMAND_REG);
        timeout = jiffies + WAIT_WORSTCASE;
@@ -772,13 +771,12 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
        SELECT_DRIVE(drive);
        SELECT_MASK(drive, 0);
        udelay(1);
-       if (IDE_CONTROL_REG)
-               hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
+       ide_set_irq(drive, 0);
        hwif->OUTB(speed, IDE_NSECTOR_REG);
        hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
        hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG);
-       if ((IDE_CONTROL_REG) && (drive->quirk_list == 2))
-               hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
+       if (drive->quirk_list == 2)
+               ide_set_irq(drive, 1);
 
        error = __ide_wait_stat(drive, drive->ready_stat,
                                BUSY_STAT|DRQ_STAT|ERR_STAT,
index 18e9b82e132ccc5a0b844058c18de2664d724b4b..9d9f1c6d602a53ffd91ed94423c232b28a7039e9 100644 (file)
@@ -350,22 +350,19 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd)
         * the irq handler isn't expecting.
         */
        if (IDE_CONTROL_REG) {
-               u8 ctl = drive->ctl | 2;
                if (!hwif->irq) {
                        autoprobe = 1;
                        cookie = probe_irq_on();
-                       /* enable device irq */
-                       ctl &= ~2;
                }
-               hwif->OUTB(ctl, IDE_CONTROL_REG);
+               ide_set_irq(drive, autoprobe);
        }
 
        retval = actual_try_to_identify(drive, cmd);
 
        if (autoprobe) {
                int irq;
-               /* mask device irq */
-               hwif->OUTB(drive->ctl|2, IDE_CONTROL_REG);
+
+               ide_set_irq(drive, 0);
                /* clear drive IRQ */
                (void) hwif->INB(IDE_STATUS_REG);
                udelay(5);
@@ -653,8 +650,7 @@ static int wait_hwif_ready(ide_hwif_t *hwif)
                /* Ignore disks that we will not probe for later. */
                if (!drive->noprobe || drive->present) {
                        SELECT_DRIVE(drive);
-                       if (IDE_CONTROL_REG)
-                               hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
+                       ide_set_irq(drive, 1);
                        mdelay(2);
                        rc = ide_wait_not_busy(hwif, 35000);
                        if (rc)
index 063e0eb6c9e41ba3c130cf3d9af3e3ccdac092ee..c58edc86ed3eb8d1722e3b19abc565803409d35c 100644 (file)
@@ -83,8 +83,7 @@ void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
                tf->hob_lbam, tf->hob_lbah);
 #endif
 
-       if (IDE_CONTROL_REG)
-               hwif->OUTB(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
+       ide_set_irq(drive, 1);
 
        if ((task->tf_flags & IDE_TFLAG_NO_SELECT_MASK) == 0)
                SELECT_MASK(drive, 0);
index 735737500f8f8f8edde89df835eea1c3e5d32d5f..74f1ef9c6d940a8a1ff92d93925bdf7bda9b25d9 100644 (file)
@@ -1302,4 +1302,9 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
        return &hwif->drives[(drive->dn ^ 1) & 1];
 }
 
+static inline void ide_set_irq(ide_drive_t *drive, int on)
+{
+       drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG);
+}
+
 #endif /* _IDE_H */