]> Pileus Git - ~andy/linux/commitdiff
staging: comedi: addi_apci_1032: add a subdevice for the interrupt support
authorH Hartley Sweeten <hartleys@visionengravers.com>
Mon, 5 Nov 2012 21:41:13 +0000 (14:41 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Nov 2012 08:30:57 +0000 (09:30 +0100)
This board supports a single interrupt that can be generated by an AND/OR
combination of 16 of the input channels.

Create a separate subdevice, similar to the comedi_parport driver, to
handle this interrupt.

Move the i_APCI1032_ConfigDigitalInput() operation from the digital
input subdevice to this new subdevice. Rename the CamelCase function
to apci1032_intr_insn_config().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi_apci_1032.c

index 3d5cbbfc8b327a08c0542cb90f6da2949392958c..bdfc8854606fb4f5344dd51eddc3bc3bfa375aa0 100644 (file)
@@ -61,10 +61,10 @@ static unsigned int ui_InterruptStatus;
  * data[2] : Interrupt mask for the mode 1
  * data[3] : Interrupt mask for the mode 2
  */
-static int i_APCI1032_ConfigDigitalInput(struct comedi_device *dev,
-                                        struct comedi_subdevice *s,
-                                        struct comedi_insn *insn,
-                                        unsigned int *data)
+static int apci1032_intr_insn_config(struct comedi_device *dev,
+                                    struct comedi_subdevice *s,
+                                    struct comedi_insn *insn,
+                                    unsigned int *data)
 {
        struct addi_private *devpriv = dev->private;
        unsigned int ui_TmpValue;
@@ -175,7 +175,7 @@ static int apci1032_attach_pci(struct comedi_device *dev,
                        dev->irq = pcidev->irq;
        }
 
-       ret = comedi_alloc_subdevices(dev, 1);
+       ret = comedi_alloc_subdevices(dev, 2);
        if (ret)
                return ret;
 
@@ -187,9 +187,18 @@ static int apci1032_attach_pci(struct comedi_device *dev,
        s->maxdata      = 1;
        s->len_chanlist = 32;
        s->range_table  = &range_digital;
-       s->insn_config  = i_APCI1032_ConfigDigitalInput;
        s->insn_bits    = apci1032_di_insn_bits;
 
+       if (dev->irq) {
+               s = &dev->subdevices[1];
+               s->type         = COMEDI_SUBD_DI;
+               s->subdev_flags = SDF_READABLE;
+               s->n_chan       = 1;
+               s->maxdata      = 1;
+               s->range_table  = &range_digital;
+               s->insn_config  = apci1032_intr_insn_config;
+       }
+
        apci1032_reset(dev);
        return 0;
 }