staging: comedi: pcl818: all board types have digital inputs and outputs
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 17 Feb 2014 21:26:54 +0000 (14:26 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Feb 2014 19:53:53 +0000 (11:53 -0800)
All the board types have 16 digital inputs and 16 digital outputs.

Remove the 'n_dichan' and 'n_dochan' members in the boardinfo. Refactor
pcl818_attach() to always setup these subdevices.

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/pcl818.c

index e709e3c0a10b3136de9f791ff795d031f95bce84..e206b78826a652d84d3478a69f449a25a1e924a0 100644 (file)
@@ -263,8 +263,6 @@ struct pcl818_board {
        int n_aichan_diff;
        unsigned int ns_min;
        int n_aochan;
-       int n_dichan;
-       int n_dochan;
        const struct comedi_lrange *ai_range_type;
        unsigned int IRQbits;
        int ai_maxdata;
@@ -282,8 +280,6 @@ static const struct pcl818_board boardtypes[] = {
                .n_aichan_diff  = 8,
                .ns_min         = 25000,
                .n_aochan       = 1,
-               .n_dichan       = 16,
-               .n_dochan       = 16,
                .ai_range_type  = &range_pcl818l_l_ai,
                .IRQbits        = 0x00fc,
                .ai_maxdata     = 0xfff,
@@ -297,8 +293,6 @@ static const struct pcl818_board boardtypes[] = {
                .n_aichan_diff  = 8,
                .ns_min         = 10000,
                .n_aochan       = 1,
-               .n_dichan       = 16,
-               .n_dochan       = 16,
                .ai_range_type  = &range_pcl818h_ai,
                .IRQbits        = 0x00fc,
                .ai_maxdata     = 0xfff,
@@ -312,8 +306,6 @@ static const struct pcl818_board boardtypes[] = {
                .n_aichan_diff  = 8,
                .ns_min         = 10000,
                .n_aochan       = 1,
-               .n_dichan       = 16,
-               .n_dochan       = 16,
                .ai_range_type  = &range_pcl818h_ai,
                .IRQbits        = 0x00fc,
                .ai_maxdata     = 0xfff,
@@ -328,8 +320,6 @@ static const struct pcl818_board boardtypes[] = {
                .n_aichan_diff  = 8,
                .ns_min         = 10000,
                .n_aochan       = 1,
-               .n_dichan       = 16,
-               .n_dochan       = 16,
                .ai_range_type  = &range_pcl818hg_ai,
                .IRQbits        = 0x00fc,
                .ai_maxdata     = 0xfff,
@@ -344,8 +334,6 @@ static const struct pcl818_board boardtypes[] = {
                .n_aichan_diff  = 8,
                .ns_min         = 10000,
                .n_aochan       = 2,
-               .n_dichan       = 16,
-               .n_dochan       = 16,
                .ai_range_type  = &range_pcl818h_ai,
                .IRQbits        = 0x00fc,
                .ai_maxdata     = 0xfff,
@@ -359,8 +347,6 @@ static const struct pcl818_board boardtypes[] = {
                .n_aichan_diff  = 8,
                .ns_min         = 16000,
                .n_aochan       = 2,
-               .n_dichan       = 16,
-               .n_dochan       = 16,
                .ai_range_type  = &range_unipolar5,
                .IRQbits        = 0x00fc,
                .ai_maxdata     = 0xfff,
@@ -372,8 +358,6 @@ static const struct pcl818_board boardtypes[] = {
                .n_aichan_se    = 16,
                .n_aichan_diff  = 8,
                .ns_min         = 10000,
-               .n_dichan       = 16,
-               .n_dochan       = 16,
                .ai_range_type  = &range_pcl818h_ai,
                .IRQbits        = 0x00fc,
                .ai_maxdata     = 0xfff,
@@ -1465,29 +1449,23 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                }
        }
 
+       /* Digital Input subdevice */
        s = &dev->subdevices[2];
-       if (!board->n_dichan) {
-               s->type = COMEDI_SUBD_UNUSED;
-       } else {
-               s->type = COMEDI_SUBD_DI;
-               s->subdev_flags = SDF_READABLE;
-               s->n_chan = board->n_dichan;
-               s->maxdata = 1;
-               s->range_table = &range_digital;
-               s->insn_bits = pcl818_di_insn_bits;
-       }
-
+       s->type         = COMEDI_SUBD_DI;
+       s->subdev_flags = SDF_READABLE;
+       s->n_chan       = 16;
+       s->maxdata      = 1;
+       s->range_table  = &range_digital;
+       s->insn_bits    = pcl818_di_insn_bits;
+
+       /* Digital Output subdevice */
        s = &dev->subdevices[3];
-       if (!board->n_dochan) {
-               s->type = COMEDI_SUBD_UNUSED;
-       } else {
-               s->type = COMEDI_SUBD_DO;
-               s->subdev_flags = SDF_WRITABLE;
-               s->n_chan = board->n_dochan;
-               s->maxdata = 1;
-               s->range_table = &range_digital;
-               s->insn_bits = pcl818_do_insn_bits;
-       }
+       s->type         = COMEDI_SUBD_DO;
+       s->subdev_flags = SDF_WRITABLE;
+       s->n_chan       = 16;
+       s->maxdata      = 1;
+       s->range_table  = &range_digital;
+       s->insn_bits    = pcl818_do_insn_bits;
 
        /* select 1/10MHz oscilator */
        if ((it->options[3] == 0) || (it->options[3] == 10))