diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2012-12-03 18:15:43 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-07 14:10:01 -0800 |
commit | b652bd83a0528c43e935cb6f2f8df024b7a85c5e (patch) | |
tree | e5eded01e3e517997b5ed08f2ab7a53b87cdee2d /drivers | |
parent | 6bf9a3babe630a9972b28fd3bb7d2cfcd40e6409 (diff) |
staging: comedi: addi_apci_2032: make insn_bits read live data
The `insn_bits` handler for the special digital input subdevice used for
interrupts currently uses `s->state` for the data value, which is set to
the value of the APCI2032_INT_STATUS_REG register when a valid interrupt
occurs. Just read the live register contents in the `insn_bits` handler
instead of relying on the interrupt service routine to read it for us.
The register contains a couple of hardware error status bits. They
might also be valid even when the corresponding bits have not been
enabled in the APCI_INT_CTRL_REG register in which case this would be
useful for checking for hardware errors without using interrupts, but
this needs to be checked.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/comedi/drivers/addi_apci_2032.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/staging/comedi/drivers/addi_apci_2032.c b/drivers/staging/comedi/drivers/addi_apci_2032.c index aeb34dbe02a..4c348dd2a5d 100644 --- a/drivers/staging/comedi/drivers/addi_apci_2032.c +++ b/drivers/staging/comedi/drivers/addi_apci_2032.c @@ -159,7 +159,7 @@ static int apci2032_int_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - data[1] = s->state; + data[1] = inl(dev->iobase + APCI2032_INT_STATUS_REG) & 3; return insn->n; } @@ -245,10 +245,10 @@ static irqreturn_t apci2032_interrupt(int irq, void *d) if (!val) return IRQ_NONE; - s->state = inl(dev->iobase + APCI2032_INT_STATUS_REG); - outl(0x0, dev->iobase + APCI2032_INT_CTRL_REG); + val = inl(dev->iobase + APCI2032_INT_STATUS_REG) & 3; + outl(0x00, dev->iobase + APCI2032_INT_CTRL_REG); - if (comedi_buf_put(s->async, s->state)) + if (comedi_buf_put(s->async, val)) s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; else s->async->events |= COMEDI_CB_OVERFLOW; |