ide: add ide_set_irq() inline helper

There should be no functionality changes caused by this patch.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 4f52a329
...@@ -939,8 +939,7 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq) ...@@ -939,8 +939,7 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
if (rc) if (rc)
printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name);
SELECT_DRIVE(drive); SELECT_DRIVE(drive);
if (IDE_CONTROL_REG) ide_set_irq(drive, 1);
HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
rc = ide_wait_not_busy(HWIF(drive), 100000); rc = ide_wait_not_busy(HWIF(drive), 100000);
if (rc) if (rc)
printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); 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) ...@@ -1213,15 +1212,13 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
} }
again: again:
hwif = HWIF(drive); hwif = HWIF(drive);
if (hwgroup->hwif->sharing_irq && if (hwgroup->hwif->sharing_irq && hwif != hwgroup->hwif) {
hwif != hwgroup->hwif &&
hwif->io_ports[IDE_CONTROL_OFFSET]) {
/* /*
* set nIEN for previous hwif, drives in the * set nIEN for previous hwif, drives in the
* quirk_list may not like intr setups/cleanups * quirk_list may not like intr setups/cleanups
*/ */
if (drive->quirk_list != 1) if (drive->quirk_list != 1)
hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG); ide_set_irq(drive, 0);
} }
hwgroup->hwif = hwif; hwgroup->hwif = hwif;
hwgroup->drive = drive; hwgroup->drive = drive;
......
...@@ -688,8 +688,7 @@ int ide_driveid_update(ide_drive_t *drive) ...@@ -688,8 +688,7 @@ int ide_driveid_update(ide_drive_t *drive)
*/ */
SELECT_MASK(drive, 1); SELECT_MASK(drive, 1);
if (IDE_CONTROL_REG) ide_set_irq(drive, 1);
hwif->OUTB(drive->ctl,IDE_CONTROL_REG);
msleep(50); msleep(50);
hwif->OUTB(WIN_IDENTIFY, IDE_COMMAND_REG); hwif->OUTB(WIN_IDENTIFY, IDE_COMMAND_REG);
timeout = jiffies + WAIT_WORSTCASE; timeout = jiffies + WAIT_WORSTCASE;
...@@ -772,13 +771,12 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) ...@@ -772,13 +771,12 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
SELECT_DRIVE(drive); SELECT_DRIVE(drive);
SELECT_MASK(drive, 0); SELECT_MASK(drive, 0);
udelay(1); udelay(1);
if (IDE_CONTROL_REG) ide_set_irq(drive, 0);
hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
hwif->OUTB(speed, IDE_NSECTOR_REG); hwif->OUTB(speed, IDE_NSECTOR_REG);
hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG); hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG);
if ((IDE_CONTROL_REG) && (drive->quirk_list == 2)) if (drive->quirk_list == 2)
hwif->OUTB(drive->ctl, IDE_CONTROL_REG); ide_set_irq(drive, 1);
error = __ide_wait_stat(drive, drive->ready_stat, error = __ide_wait_stat(drive, drive->ready_stat,
BUSY_STAT|DRQ_STAT|ERR_STAT, BUSY_STAT|DRQ_STAT|ERR_STAT,
......
...@@ -350,22 +350,19 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd) ...@@ -350,22 +350,19 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd)
* the irq handler isn't expecting. * the irq handler isn't expecting.
*/ */
if (IDE_CONTROL_REG) { if (IDE_CONTROL_REG) {
u8 ctl = drive->ctl | 2;
if (!hwif->irq) { if (!hwif->irq) {
autoprobe = 1; autoprobe = 1;
cookie = probe_irq_on(); 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); retval = actual_try_to_identify(drive, cmd);
if (autoprobe) { if (autoprobe) {
int irq; int irq;
/* mask device irq */
hwif->OUTB(drive->ctl|2, IDE_CONTROL_REG); ide_set_irq(drive, 0);
/* clear drive IRQ */ /* clear drive IRQ */
(void) hwif->INB(IDE_STATUS_REG); (void) hwif->INB(IDE_STATUS_REG);
udelay(5); udelay(5);
...@@ -653,8 +650,7 @@ static int wait_hwif_ready(ide_hwif_t *hwif) ...@@ -653,8 +650,7 @@ static int wait_hwif_ready(ide_hwif_t *hwif)
/* Ignore disks that we will not probe for later. */ /* Ignore disks that we will not probe for later. */
if (!drive->noprobe || drive->present) { if (!drive->noprobe || drive->present) {
SELECT_DRIVE(drive); SELECT_DRIVE(drive);
if (IDE_CONTROL_REG) ide_set_irq(drive, 1);
hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
mdelay(2); mdelay(2);
rc = ide_wait_not_busy(hwif, 35000); rc = ide_wait_not_busy(hwif, 35000);
if (rc) if (rc)
......
...@@ -83,8 +83,7 @@ void ide_tf_load(ide_drive_t *drive, ide_task_t *task) ...@@ -83,8 +83,7 @@ void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
tf->hob_lbam, tf->hob_lbah); tf->hob_lbam, tf->hob_lbah);
#endif #endif
if (IDE_CONTROL_REG) ide_set_irq(drive, 1);
hwif->OUTB(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
if ((task->tf_flags & IDE_TFLAG_NO_SELECT_MASK) == 0) if ((task->tf_flags & IDE_TFLAG_NO_SELECT_MASK) == 0)
SELECT_MASK(drive, 0); SELECT_MASK(drive, 0);
......
...@@ -1302,4 +1302,9 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) ...@@ -1302,4 +1302,9 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
return &hwif->drives[(drive->dn ^ 1) & 1]; 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 */ #endif /* _IDE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment