[PATCH 15/22] staging: comedi: addi_apci_16xx: cleanup subdevice initialization

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

 



The comedi subdevice in this driver is a simple digital i/o
device.

Currently, the code abuses the comedi API by redefining the
COMEDI_SUBD_SERIAL type as COMEDI_SUBD_TTLIO and using that
for the 's->type'. Remove the defines and use the proper type,
COMEDI_SUBD_DIO.

The current code also sets the subdev_flags SDF_GROUND and SDF_COMMON
for the subdevice. These flags really only have meaning for analog
subdevices. Remove them.

All the boards supported by this driver use the same functions for
the subdevice 'insn_*' operations. Remove this information from
the boardinfo and set the s->insn_* operations directly in the init.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 .../comedi/drivers/addi-data/hwdrv_apci16xx.c      |  4 ---
 drivers/staging/comedi/drivers/addi_apci_16xx.c    | 35 +++++++---------------
 2 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c
index da4f03b..97f7441 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c
@@ -47,10 +47,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour
   +-----------------------------------------------------------------------+
 */
 
-#ifndef COMEDI_SUBD_TTLIO
-#define COMEDI_SUBD_TTLIO		11 /* Digital Input Output But TTL */
-#endif
-
 #define APCI16XX_TTL_INIT		0
 #define APCI16XX_TTL_INITDIRECTION	1
 #define APCI16XX_TTL_OUTPUTMEMORY	2
diff --git a/drivers/staging/comedi/drivers/addi_apci_16xx.c b/drivers/staging/comedi/drivers/addi_apci_16xx.c
index 5f1de01..3ad3fec 100644
--- a/drivers/staging/comedi/drivers/addi_apci_16xx.c
+++ b/drivers/staging/comedi/drivers/addi_apci_16xx.c
@@ -3,10 +3,6 @@
 
 #include "addi-data/addi_common.h"
 
-#ifndef COMEDI_SUBD_TTLIO
-#define COMEDI_SUBD_TTLIO   11	/* Digital Input Output But TTL */
-#endif
-
 #include "addi-data/hwdrv_apci16xx.c"
 
 static const struct addi_board apci16xx_boardtypes[] = {
@@ -15,19 +11,11 @@ static const struct addi_board apci16xx_boardtypes[] = {
 		.i_VendorId		= PCI_VENDOR_ID_ADDIDATA,
 		.i_DeviceId		= 0x1009,
 		.i_NbrTTLChannel	= 48,
-		.ttl_config		= i_APCI16XX_InsnConfigInitTTLIO,
-		.ttl_bits		= i_APCI16XX_InsnBitsReadTTLIO,
-		.ttl_read		= i_APCI16XX_InsnReadTTLIOAllPortValue,
-		.ttl_write		= i_APCI16XX_InsnBitsWriteTTLIO,
 	}, {
 		.pc_DriverName		= "apci1696",
 		.i_VendorId		= PCI_VENDOR_ID_ADDIDATA,
 		.i_DeviceId		= 0x100A,
 		.i_NbrTTLChannel	= 96,
-		.ttl_config		= i_APCI16XX_InsnConfigInitTTLIO,
-		.ttl_bits		= i_APCI16XX_InsnBitsReadTTLIO,
-		.ttl_read		= i_APCI16XX_InsnReadTTLIOAllPortValue,
-		.ttl_write		= i_APCI16XX_InsnBitsWriteTTLIO,
 	},
 };
 
@@ -80,18 +68,17 @@ static int apci16xx_auto_attach(struct comedi_device *dev,
 
 	/* Initialize the TTL digital i/o */
 	s = &dev->subdevices[0];
-	s->type = COMEDI_SUBD_TTLIO;
-	s->subdev_flags =
-		SDF_WRITEABLE | SDF_READABLE | SDF_GROUND | SDF_COMMON;
-	s->n_chan = this_board->i_NbrTTLChannel;
-	s->maxdata = 1;
-	s->io_bits = 0;	/* all bits input */
-	s->len_chanlist = this_board->i_NbrTTLChannel;
-	s->range_table = &range_digital;
-	s->insn_config = this_board->ttl_config;
-	s->insn_bits = this_board->ttl_bits;
-	s->insn_read = this_board->ttl_read;
-	s->insn_write = this_board->ttl_write;
+	s->type		= COMEDI_SUBD_DIO;
+	s->subdev_flags	= SDF_WRITEABLE | SDF_READABLE;
+	s->n_chan	= this_board->i_NbrTTLChannel;
+	s->maxdata	= 1;
+	s->io_bits	= 0;	/* all bits input */
+	s->len_chanlist	= this_board->i_NbrTTLChannel;
+	s->range_table	= &range_digital;
+	s->insn_config	= i_APCI16XX_InsnConfigInitTTLIO;
+	s->insn_bits	= i_APCI16XX_InsnBitsReadTTLIO;
+	s->insn_read	= i_APCI16XX_InsnReadTTLIOAllPortValue;
+	s->insn_write	= i_APCI16XX_InsnBitsWriteTTLIO;
 
 	return 0;
 }
-- 
1.8.0

_______________________________________________
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