summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi
diff options
context:
space:
mode:
authorH Hartley Sweeten2015-10-12 21:16:36 +0200
committerGreg Kroah-Hartman2015-10-13 19:26:06 +0200
commit6db70e3934c02c76f85c128e01585d8b6a8fbe61 (patch)
tree32ea05001e809851f9248c9e3cbe52e1dc0590c3 /drivers/staging/comedi
parentstaging: comedi: aio_aio12_8: fix ai (*insn_read) (diff)
downloadkernel-qcow2-linux-6db70e3934c02c76f85c128e01585d8b6a8fbe61.tar.gz
kernel-qcow2-linux-6db70e3934c02c76f85c128e01585d8b6a8fbe61.tar.xz
kernel-qcow2-linux-6db70e3934c02c76f85c128e01585d8b6a8fbe61.zip
staging: comedi: aio_aio12_8: refactor boardininfo
This driver supports three board types with these differences: 104-AIO12-8 - eight 12-bit analog in, four 12-bit analog out 104-AI12-8 - eight 12-bit analog in 104-AO12-4 - four 12-bit analog out Convert the boardinfo 'ai_nchan' and 'ao_nchan' into bit-field flags 'has_ai' and 'has_ao' so save a bit of space. 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>
Diffstat (limited to 'drivers/staging/comedi')
-rw-r--r--drivers/staging/comedi/drivers/aio_aio12_8.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/staging/comedi/drivers/aio_aio12_8.c b/drivers/staging/comedi/drivers/aio_aio12_8.c
index e76a1309a168..8d2c494b5cd8 100644
--- a/drivers/staging/comedi/drivers/aio_aio12_8.c
+++ b/drivers/staging/comedi/drivers/aio_aio12_8.c
@@ -87,21 +87,21 @@ static const struct comedi_lrange aio_aio12_8_range = {
struct aio12_8_boardtype {
const char *name;
- int ai_nchan;
- int ao_nchan;
+ unsigned int has_ai:1;
+ unsigned int has_ao:1;
};
static const struct aio12_8_boardtype board_types[] = {
{
.name = "aio_aio12_8",
- .ai_nchan = 8,
- .ao_nchan = 4,
+ .has_ai = 1,
+ .has_ao = 1,
}, {
.name = "aio_ai12_8",
- .ai_nchan = 8,
+ .has_ai = 1,
}, {
.name = "aio_ao12_8",
- .ao_nchan = 4,
+ .has_ao = 1,
},
};
@@ -225,12 +225,12 @@ static int aio_aio12_8_attach(struct comedi_device *dev,
if (ret)
return ret;
+ /* Analog Input subdevice */
s = &dev->subdevices[0];
- if (board->ai_nchan) {
- /* Analog input subdevice */
+ if (board->has_ai) {
s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF;
- s->n_chan = board->ai_nchan;
+ s->n_chan = 8;
s->maxdata = 0x0fff;
s->range_table = &aio_aio12_8_range;
s->insn_read = aio_aio12_8_ai_read;
@@ -238,9 +238,9 @@ static int aio_aio12_8_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED;
}
+ /* Analog Output subdevice */
s = &dev->subdevices[1];
- if (board->ao_nchan) {
- /* Analog output subdevice */
+ if (board->has_ao) {
s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE | SDF_GROUND;
s->n_chan = 4;