staging: comedi: addi_apci_3xxx: absorb apci3xxx_di_insn_bits()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 12 Jun 2013 23:05:42 +0000 (16:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jun 2013 21:33:38 +0000 (14:33 -0700)
All the boards supported by this driver that have digital inputs use
the same 'di_bits' callback in the boardinfo. Absorb the function from
hwdrv_apci3xxx.c directly into the driver.

Remove the 'di_bits' callback from the boardinfo and use the function
directly to set the subdevice (*insn_bits).

None of the boards supported by this driver have a 'di_config', 'di_read',
or 'io_write' callback. Remove the unnecessary setting of the subdevice
callbacks.

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

index 383b70e536b4075784c8fd73d34d1757d0d9e0c6..48c3432d22d6b605dee4e09a028ad29a334e9387 100644 (file)
@@ -1271,15 +1271,3 @@ static int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev,
 
        return i_ReturnValue;
 }
-
-static int apci3xxx_di_insn_bits(struct comedi_device *dev,
-                                struct comedi_subdevice *s,
-                                struct comedi_insn *insn,
-                                unsigned int *data)
-{
-       struct addi_private *devpriv = dev->private;
-
-       data[1] = inl(devpriv->iobase + 32) & 0xf;
-
-       return insn->n;
-}
index f2ebce03a7292b4654510bc5077c86218a9065ba..ac59359720ae1ac062d79a3debb2c2e29bfd1469 100644 (file)
@@ -187,7 +187,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .interrupt              = v_APCI3XXX_Interrupt,
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
-               .di_bits                = apci3xxx_di_insn_bits,
                .ttl_config             = i_APCI3XXX_InsnConfigInitTTLIO,
                .ttl_bits               = i_APCI3XXX_InsnBitsTTLIO,
                .ttl_read               = i_APCI3XXX_InsnReadTTLIO,
@@ -212,7 +211,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .interrupt              = v_APCI3XXX_Interrupt,
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
-               .di_bits                = apci3xxx_di_insn_bits,
                .ttl_config             = i_APCI3XXX_InsnConfigInitTTLIO,
                .ttl_bits               = i_APCI3XXX_InsnBitsTTLIO,
                .ttl_read               = i_APCI3XXX_InsnReadTTLIO,
@@ -237,7 +235,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .interrupt              = v_APCI3XXX_Interrupt,
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
-               .di_bits                = apci3xxx_di_insn_bits,
                .ttl_config             = i_APCI3XXX_InsnConfigInitTTLIO,
                .ttl_bits               = i_APCI3XXX_InsnBitsTTLIO,
                .ttl_read               = i_APCI3XXX_InsnReadTTLIO,
@@ -262,7 +259,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .interrupt              = v_APCI3XXX_Interrupt,
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
-               .di_bits                = apci3xxx_di_insn_bits,
                .ttl_config             = i_APCI3XXX_InsnConfigInitTTLIO,
                .ttl_bits               = i_APCI3XXX_InsnBitsTTLIO,
                .ttl_read               = i_APCI3XXX_InsnReadTTLIO,
@@ -287,7 +283,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .interrupt              = v_APCI3XXX_Interrupt,
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
-               .di_bits                = apci3xxx_di_insn_bits,
                .ttl_config             = i_APCI3XXX_InsnConfigInitTTLIO,
                .ttl_bits               = i_APCI3XXX_InsnBitsTTLIO,
                .ttl_read               = i_APCI3XXX_InsnReadTTLIO,
@@ -312,7 +307,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .interrupt              = v_APCI3XXX_Interrupt,
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
-               .di_bits                = apci3xxx_di_insn_bits,
                .ttl_config             = i_APCI3XXX_InsnConfigInitTTLIO,
                .ttl_bits               = i_APCI3XXX_InsnBitsTTLIO,
                .ttl_read               = i_APCI3XXX_InsnReadTTLIO,
@@ -441,7 +435,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
                .ao_write               = i_APCI3XXX_InsnWriteAnalogOutput,
-               .di_bits                = apci3xxx_di_insn_bits,
                .ttl_config             = i_APCI3XXX_InsnConfigInitTTLIO,
                .ttl_bits               = i_APCI3XXX_InsnBitsTTLIO,
                .ttl_read               = i_APCI3XXX_InsnReadTTLIO,
@@ -470,7 +463,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
                .ao_write               = i_APCI3XXX_InsnWriteAnalogOutput,
-               .di_bits                = apci3xxx_di_insn_bits,
                .ttl_config             = i_APCI3XXX_InsnConfigInitTTLIO,
                .ttl_bits               = i_APCI3XXX_InsnBitsTTLIO,
                .ttl_read               = i_APCI3XXX_InsnReadTTLIO,
@@ -499,7 +491,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
                .ao_write               = i_APCI3XXX_InsnWriteAnalogOutput,
-               .di_bits                = apci3xxx_di_insn_bits,
                .ttl_config             = i_APCI3XXX_InsnConfigInitTTLIO,
                .ttl_bits               = i_APCI3XXX_InsnBitsTTLIO,
                .ttl_read               = i_APCI3XXX_InsnReadTTLIO,
@@ -528,7 +519,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
                .ao_write               = i_APCI3XXX_InsnWriteAnalogOutput,
-               .di_bits                = apci3xxx_di_insn_bits,
                .ttl_config             = i_APCI3XXX_InsnConfigInitTTLIO,
                .ttl_bits               = i_APCI3XXX_InsnBitsTTLIO,
                .ttl_read               = i_APCI3XXX_InsnReadTTLIO,
@@ -551,7 +541,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .interrupt              = v_APCI3XXX_Interrupt,
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
-               .di_bits                = apci3xxx_di_insn_bits,
        },
        [BOARD_APCI3002_16] = {
                .pc_DriverName          = "apci3002-16",
@@ -570,7 +559,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .interrupt              = v_APCI3XXX_Interrupt,
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
-               .di_bits                = apci3xxx_di_insn_bits,
        },
        [BOARD_APCI3002_8] = {
                .pc_DriverName          = "apci3002-8",
@@ -589,7 +577,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .interrupt              = v_APCI3XXX_Interrupt,
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
-               .di_bits                = apci3xxx_di_insn_bits,
        },
        [BOARD_APCI3002_4] = {
                .pc_DriverName          = "apci3002-4",
@@ -608,7 +595,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
                .interrupt              = v_APCI3XXX_Interrupt,
                .ai_config              = i_APCI3XXX_InsnConfigAnalogInput,
                .ai_read                = i_APCI3XXX_InsnReadAnalogInput,
-               .di_bits                = apci3xxx_di_insn_bits,
        },
        [BOARD_APCI3500] = {
                .pc_DriverName          = "apci3500",
@@ -628,6 +614,18 @@ static const struct addi_board apci3xxx_boardtypes[] = {
        },
 };
 
+static int apci3xxx_di_insn_bits(struct comedi_device *dev,
+                                struct comedi_subdevice *s,
+                                struct comedi_insn *insn,
+                                unsigned int *data)
+{
+       struct addi_private *devpriv = dev->private;
+
+       data[1] = inl(devpriv->iobase + 32) & 0xf;
+
+       return insn->n;
+}
+
 static int apci3xxx_do_insn_bits(struct comedi_device *dev,
                                 struct comedi_subdevice *s,
                                 struct comedi_insn *insn,
@@ -856,10 +854,7 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
                s->len_chanlist = devpriv->s_EeParameters.i_NbrDiChannel;
                s->range_table = &range_digital;
                s->io_bits = 0; /* all bits input */
-               s->insn_config = board->di_config;
-               s->insn_read = board->di_read;
-               s->insn_write = board->di_write;
-               s->insn_bits = board->di_bits;
+               s->insn_bits = apci3xxx_di_insn_bits;
        } else {
                s->type = COMEDI_SUBD_UNUSED;
        }