Commit c089d5af authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: adl_pci9118: tidy up interrupt_pci9118()

For aesthetics, rename this function so it has namespace associated
with the driver.

Refactor the function to reduce the indent level and tidy up the code.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 901be534
...@@ -1030,75 +1030,62 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, ...@@ -1030,75 +1030,62 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
cfc_handle_events(dev, s); cfc_handle_events(dev, s);
} }
static irqreturn_t interrupt_pci9118(int irq, void *d) static irqreturn_t pci9118_interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->read_subdev; struct comedi_subdevice *s = dev->read_subdev;
struct pci9118_private *devpriv = dev->private; struct pci9118_private *devpriv = dev->private;
unsigned int int_daq = 0, int_amcc, int_adstat; unsigned int intsrc; /* IRQ reasons from card */
unsigned int intcsr; /* INT register from AMCC chip */
unsigned int adstat; /* STATUS register */
if (!dev->attached) if (!dev->attached)
return IRQ_NONE; /* not fully initialized */ return IRQ_NONE;
int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf; intsrc = inl(dev->iobase + PCI9118_INTSRC) & 0xf;
/* get IRQ reasons from card */ intcsr = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR);
int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR);
/* get INT register from AMCC chip */
if ((!int_daq) && (!(int_amcc & ANY_S593X_INT))) if (!intsrc && !(intcsr & ANY_S593X_INT))
return IRQ_NONE; /* interrupt from other source */ return IRQ_NONE;
outl(int_amcc | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR); outl(intcsr | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR);
/* shutdown IRQ reasons in AMCC */
int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff; adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff;
/* get STATUS register */
if (!devpriv->ai_do)
return IRQ_HANDLED;
if (devpriv->ai_do) {
if (devpriv->ai12_startstop) { if (devpriv->ai12_startstop) {
if ((int_adstat & AdStatus_DTH) && if ((adstat & AdStatus_DTH) && (intsrc & Int_DTrg)) {
(int_daq & Int_DTrg)) { /* start/stop of measure */
/* start stop of measure */
if (devpriv->ai12_startstop & START_AI_EXT) { if (devpriv->ai12_startstop & START_AI_EXT) {
devpriv->ai12_startstop &=
~START_AI_EXT;
if (!(devpriv->ai12_startstop &
STOP_AI_EXT))
pci9118_exttrg_del
(dev, EXTTRG_AI);
/* deactivate EXT trigger */ /* deactivate EXT trigger */
devpriv->ai12_startstop &= ~START_AI_EXT;
if (!(devpriv->ai12_startstop & STOP_AI_EXT))
pci9118_exttrg_del(dev, EXTTRG_AI);
/* start pacer */
start_pacer(dev, devpriv->ai_do, start_pacer(dev, devpriv->ai_do,
devpriv->ai_divisor1, devpriv->ai_divisor1,
devpriv->ai_divisor2); devpriv->ai_divisor2);
/* start pacer */
outl(devpriv->AdControlReg, outl(devpriv->AdControlReg,
dev->iobase + PCI9118_ADCNTRL); dev->iobase + PCI9118_ADCNTRL);
} else { } else if (devpriv->ai12_startstop & STOP_AI_EXT) {
if (devpriv->ai12_startstop &
STOP_AI_EXT) {
devpriv->ai12_startstop &=
~STOP_AI_EXT;
pci9118_exttrg_del
(dev, EXTTRG_AI);
/* deactivate EXT trigger */ /* deactivate EXT trigger */
devpriv->ai12_startstop &= ~STOP_AI_EXT;
pci9118_exttrg_del(dev, EXTTRG_AI);
/* on next interrupt measure will stop */
devpriv->ai_neverending = 0; devpriv->ai_neverending = 0;
/*
* well, on next interrupt from
* DMA/EOC measure will stop
*/
}
} }
} }
} }
if (devpriv->usedma) if (devpriv->usedma)
interrupt_pci9118_ai_dma(dev, s, int_adstat, interrupt_pci9118_ai_dma(dev, s, adstat, intcsr, intsrc);
int_amcc, int_daq);
else else
interrupt_pci9118_ai_onesample(dev, s, int_adstat, interrupt_pci9118_ai_onesample(dev, s, adstat, intcsr, intsrc);
int_amcc, int_daq);
}
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -1945,7 +1932,7 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, ...@@ -1945,7 +1932,7 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq,
/* Enable parity check for parity error */ /* Enable parity check for parity error */
if (!disable_irq && pcidev->irq) { if (!disable_irq && pcidev->irq) {
ret = request_irq(pcidev->irq, interrupt_pci9118, IRQF_SHARED, ret = request_irq(pcidev->irq, pci9118_interrupt, IRQF_SHARED,
dev->board_name, dev); dev->board_name, dev);
if (ret == 0) if (ret == 0)
dev->irq = pcidev->irq; dev->irq = pcidev->irq;
......
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