staging: comedi: me4000: refactor 'ao_nchan' boardinfo
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 5 Aug 2015 17:44:46 +0000 (10:44 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Aug 2015 22:03:28 +0000 (15:03 -0700)
For the boards that have analog output capability, there are always
4 analog output channels. Convert the 'ao_nchan' member of the boardinfo
into a bit-field, 'has_ao', to save a bit of space and set the analog
output subdevice 'n_chan' to 4 when supported.

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

index 7eade91a04f604694079b6057175f85027d3d2b0..2f11cdd3eefbb5aa6cf70566f4bd7e8f946161a9 100644 (file)
@@ -188,12 +188,12 @@ enum me4000_boardid {
 
 struct me4000_board {
        const char *name;
-       int ao_nchan;
        int ao_fifo;
        int ai_nchan;
        int ai_sh_nchan;
        unsigned int can_do_diff_ai:1;
        unsigned int ex_trig_analog:1;
+       unsigned int has_ao:1;
        unsigned int has_counter:1;
 };
 
@@ -230,74 +230,74 @@ static const struct me4000_board me4000_boards[] = {
        },
        [BOARD_ME4670] = {
                .name           = "ME-4670",
-               .ao_nchan       = 4,
                .ai_nchan       = 32,
                .can_do_diff_ai = 1,
                .ex_trig_analog = 1,
+               .has_ao         = 1,
                .has_counter    = 1,
        },
        [BOARD_ME4670I] = {
                .name           = "ME-4670i",
-               .ao_nchan       = 4,
                .ai_nchan       = 32,
                .can_do_diff_ai = 1,
                .ex_trig_analog = 1,
+               .has_ao         = 1,
                .has_counter    = 1,
        },
        [BOARD_ME4670S] = {
                .name           = "ME-4670s",
-               .ao_nchan       = 4,
                .ai_nchan       = 32,
                .ai_sh_nchan    = 8,
                .can_do_diff_ai = 1,
                .ex_trig_analog = 1,
+               .has_ao         = 1,
                .has_counter    = 1,
        },
        [BOARD_ME4670IS] = {
                .name           = "ME-4670is",
-               .ao_nchan       = 4,
                .ai_nchan       = 32,
                .ai_sh_nchan    = 8,
                .can_do_diff_ai = 1,
                .ex_trig_analog = 1,
+               .has_ao         = 1,
                .has_counter    = 1,
        },
        [BOARD_ME4680] = {
                .name           = "ME-4680",
-               .ao_nchan       = 4,
                .ao_fifo        = 4,
                .ai_nchan       = 32,
                .can_do_diff_ai = 1,
                .ex_trig_analog = 1,
+               .has_ao         = 1,
                .has_counter    = 1,
        },
        [BOARD_ME4680I] = {
                .name           = "ME-4680i",
-               .ao_nchan       = 4,
                .ao_fifo        = 4,
                .ai_nchan       = 32,
                .can_do_diff_ai = 1,
                .ex_trig_analog = 1,
+               .has_ao         = 1,
                .has_counter    = 1,
        },
        [BOARD_ME4680S] = {
                .name           = "ME-4680s",
-               .ao_nchan       = 4,
                .ao_fifo        = 4,
                .ai_nchan       = 32,
                .ai_sh_nchan    = 8,
                .can_do_diff_ai = 1,
                .ex_trig_analog = 1,
+               .has_ao         = 1,
                .has_counter    = 1,
        },
        [BOARD_ME4680IS] = {
                .name           = "ME-4680is",
-               .ao_nchan       = 4,
                .ao_fifo        = 4,
                .ai_nchan       = 32,
                .ai_sh_nchan    = 8,
                .can_do_diff_ai = 1,
                .ex_trig_analog = 1,
+               .has_ao         = 1,
                .has_counter    = 1,
        },
 };
@@ -1312,10 +1312,10 @@ static int me4000_auto_attach(struct comedi_device *dev,
 
        s = &dev->subdevices[1];
 
-       if (board->ao_nchan) {
+       if (board->has_ao) {
                s->type = COMEDI_SUBD_AO;
                s->subdev_flags = SDF_WRITABLE | SDF_COMMON | SDF_GROUND;
-               s->n_chan = board->ao_nchan;
+               s->n_chan = 4;
                s->maxdata = 0xFFFF;    /*  16 bit DAC */
                s->range_table = &range_bipolar10;
                s->insn_write = me4000_ao_insn_write;