[PATCH 25/29] staging: comedi: addi_apci_1032: add a subdevice for the interrupt support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/addi_apci_1032.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1032.c b/drivers/staging/comedi/drivers/addi_apci_1032.c
index 3d5cbbf..bdfc885 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1032.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1032.c
@@ -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;
 }
-- 
1.7.11

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux