Commit 8d472906 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi_apci_3xxx: remove 'i_NbrAiChannelDiff' boardinfo

The number of differential analog input channels is always half the
number of single-ended channels, 'ai_n_chan', or all the channels
if the board does not support single-ended channels. We can use the
'ai_subdev_flags' boardinfo to determine if the board does not support
single-ended channels.

To simplify the boardinfo, remove the 'i_NbrAiChannelDiff' and just
use 'ai_n_chan' to specify the number of channels.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 47bd1ad8
......@@ -83,7 +83,6 @@ struct apci3xxx_boardinfo {
const char *name;
int ai_subdev_flags;
int ai_n_chan;
int i_NbrAiChannelDiff;
unsigned int ai_maxdata;
unsigned char ai_conv_units;
unsigned int ai_min_acq_ns;
......@@ -98,7 +97,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3000-16",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 16,
.i_NbrAiChannelDiff = 8,
.ai_maxdata = 0x0fff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 10000,
......@@ -108,7 +106,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3000-8",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 8,
.i_NbrAiChannelDiff = 4,
.ai_maxdata = 0x0fff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 10000,
......@@ -118,7 +115,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3000-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 4,
.i_NbrAiChannelDiff = 2,
.ai_maxdata = 0x0fff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 10000,
......@@ -128,7 +124,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3006-16",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 16,
.i_NbrAiChannelDiff = 8,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 10000,
......@@ -138,7 +133,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3006-8",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 8,
.i_NbrAiChannelDiff = 4,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 10000,
......@@ -148,7 +142,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3006-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 4,
.i_NbrAiChannelDiff = 2,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 10000,
......@@ -158,7 +151,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3010-16",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 16,
.i_NbrAiChannelDiff = 8,
.ai_maxdata = 0x0fff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -170,7 +162,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3010-8",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 8,
.i_NbrAiChannelDiff = 4,
.ai_maxdata = 0x0fff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -182,7 +173,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3010-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 4,
.i_NbrAiChannelDiff = 2,
.ai_maxdata = 0x0fff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -194,7 +184,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3016-16",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 16,
.i_NbrAiChannelDiff = 8,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -206,7 +195,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3016-8",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 8,
.i_NbrAiChannelDiff = 4,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -218,7 +206,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3016-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 4,
.i_NbrAiChannelDiff = 2,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -230,7 +217,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3100-16-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 16,
.i_NbrAiChannelDiff = 8,
.ai_maxdata = 0x0fff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 10000,
......@@ -241,7 +227,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3100-8-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 8,
.i_NbrAiChannelDiff = 4,
.ai_maxdata = 0x0fff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 10000,
......@@ -252,7 +237,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3106-16-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 16,
.i_NbrAiChannelDiff = 8,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 10000,
......@@ -263,7 +247,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3106-8-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 8,
.i_NbrAiChannelDiff = 4,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 10000,
......@@ -274,7 +257,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3110-16-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 16,
.i_NbrAiChannelDiff = 8,
.ai_maxdata = 0x0fff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -287,7 +269,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3110-8-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 8,
.i_NbrAiChannelDiff = 4,
.ai_maxdata = 0x0fff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -300,7 +281,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3116-16-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 16,
.i_NbrAiChannelDiff = 8,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -313,7 +293,6 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
.name = "apci3116-8-4",
.ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF,
.ai_n_chan = 8,
.i_NbrAiChannelDiff = 4,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -325,7 +304,7 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
[BOARD_APCI3003] = {
.name = "apci3003",
.ai_subdev_flags = SDF_DIFF,
.i_NbrAiChannelDiff = 4,
.ai_n_chan = 4,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US |
CONV_UNIT_NS,
......@@ -336,7 +315,7 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
[BOARD_APCI3002_16] = {
.name = "apci3002-16",
.ai_subdev_flags = SDF_DIFF,
.i_NbrAiChannelDiff = 16,
.ai_n_chan = 16,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -346,7 +325,7 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
[BOARD_APCI3002_8] = {
.name = "apci3002-8",
.ai_subdev_flags = SDF_DIFF,
.i_NbrAiChannelDiff = 8,
.ai_n_chan = 8,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -356,7 +335,7 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
[BOARD_APCI3002_4] = {
.name = "apci3002-4",
.ai_subdev_flags = SDF_DIFF,
.i_NbrAiChannelDiff = 4,
.ai_n_chan = 4,
.ai_maxdata = 0xffff,
.ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US,
.ai_min_acq_ns = 5000,
......@@ -621,24 +600,20 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
/* Allocate and Initialise AI Subdevice Structures */
s = &dev->subdevices[0];
if (board->ai_n_chan || board->i_NbrAiChannelDiff) {
if (board->ai_n_chan) {
dev->read_subdev = s;
s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | board->ai_subdev_flags;
if (board->ai_n_chan) {
s->n_chan = board->ai_n_chan;
devpriv->b_SingelDiff = 0;
} else {
s->n_chan = board->i_NbrAiChannelDiff;
devpriv->b_SingelDiff = 1;
}
s->maxdata = board->ai_maxdata;
s->len_chanlist = s->n_chan;
s->range_table = &apci3xxx_ai_range;
s->insn_config = apci3xxx_ai_insn_config;
s->insn_read = apci3xxx_ai_insn_read;
if ((board->ai_subdev_flags & (SDF_COMMON | SDF_GROUND)) == 0)
devpriv->b_SingelDiff = 1;
} else {
s->type = COMEDI_SUBD_UNUSED;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment