diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2012-12-03 18:15:46 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-07 14:10:02 -0800 |
commit | 5f6c2a954d17544c68ce83d016ea456207cadeac (patch) | |
tree | 10be867a5c13963c2bef7f75f5e393cb46d245c6 | |
parent | 5c2d4cba9586ddc3505f51bddf935ddc65a0e0bb (diff) |
staging: comedi: addi_apci_2032: always initialize interrupt subdevice
Initialize the special interrupt subdevice as a digital input subdevice
even if the interrupt handler cannot be registered. It's `insn_bits`
handler will still read the interrupt status register. This hardware
status bits in this register might be valid even if they haven't been
enabled in the interrupt control register, but this needs to be checked.
In any case, initializing the subdevice as a digital input subdevice is
harmless.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/addi_apci_2032.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/staging/comedi/drivers/addi_apci_2032.c b/drivers/staging/comedi/drivers/addi_apci_2032.c index dd81ddc3d98..c302bf9ba4e 100644 --- a/drivers/staging/comedi/drivers/addi_apci_2032.c +++ b/drivers/staging/comedi/drivers/addi_apci_2032.c @@ -377,6 +377,12 @@ static int apci2032_auto_attach(struct comedi_device *dev, /* Initialize the interrupt subdevice */ s = &dev->subdevices[2]; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 2; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci2032_int_insn_bits; if (dev->irq) { struct apci2032_int_private *subpriv; @@ -386,18 +392,11 @@ static int apci2032_auto_attach(struct comedi_device *dev, return -ENOMEM; spin_lock_init(&subpriv->spinlock); s->private = subpriv; - s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE | SDF_CMD_READ; - s->n_chan = 2; s->len_chanlist = 2; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci2032_int_insn_bits; s->do_cmdtest = apci2032_int_cmdtest; s->do_cmd = apci2032_int_cmd; s->cancel = apci2032_int_cancel; - } else { - s->type = COMEDI_SUBD_UNUSED; } return 0; |