staging: comedi: me4000: remove struct me4000_ai_info
authorH Hartley Sweeten <hartleys@visionengravers.com>
Sat, 8 Sep 2012 00:40:06 +0000 (17:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Sep 2012 04:45:27 +0000 (21:45 -0700)
The me4000_aio_info in the boardinfo struct is used to indicate
the number of analog input channels and a couple other details
about them. Remove the extra struct and absorb the data into the
boardinfo struct.

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

index 8ca02305890e8f8f2922bfe75aecd8999cb8d56e..cd001c30dc92420cb56571929df70a6e5391fd80 100644 (file)
@@ -68,46 +68,36 @@ static const struct me4000_board me4000_boards[] = {
        {
                .name           = "ME-4650",
                .device_id      = 0x4650,
-               .ai             = {
-                       .count          = 16,
-               },
+               .ai_nchan       = 16,
                .dio_nchan      = 32,
        }, {
                .name           = "ME-4660",
                .device_id      = 0x4660,
-               .ai             = {
-                       .count          = 32,
-                       .diff_count     = 16,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
                .dio_nchan      = 32,
                .has_counter    = 1,
        }, {
                .name           = "ME-4660i",
                .device_id      = 0x4661,
-               .ai             = {
-                       .count          = 32,
-                       .diff_count     = 16,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
                .dio_nchan      = 32,
                .has_counter    = 1,
        }, {
                .name           = "ME-4660s",
                .device_id      = 0x4662,
-               .ai             = {
-                       .count          = 32,
-                       .sh_count       = 8,
-                       .diff_count     = 16,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
+               .ai_sh_nchan    = 8,
                .dio_nchan      = 32,
                .has_counter    = 1,
        }, {
                .name           = "ME-4660is",
                .device_id      = 0x4663,
-               .ai             = {
-                       .count          = 32,
-                       .sh_count       = 8,
-                       .diff_count     = 16,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
+               .ai_sh_nchan    = 8,
                .dio_nchan      = 32,
                .has_counter    = 1,
        }, {
@@ -116,11 +106,9 @@ static const struct me4000_board me4000_boards[] = {
                .ao             = {
                        .count          = 4,
                },
-               .ai             = {
-                       .count          = 32,
-                       .diff_count     = 16,
-                       .ex_trig_analog = 1,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
+               .ex_trig_analog = 1,
                .dio_nchan      = 32,
                .has_counter    = 1,
        }, {
@@ -129,11 +117,9 @@ static const struct me4000_board me4000_boards[] = {
                .ao             = {
                        .count          = 4,
                },
-               .ai             = {
-                       .count          = 32,
-                       .diff_count     = 16,
-                       .ex_trig_analog = 1,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
+               .ex_trig_analog = 1,
                .dio_nchan      = 32,
                .has_counter    = 1,
        }, {
@@ -142,12 +128,10 @@ static const struct me4000_board me4000_boards[] = {
                .ao             = {
                        .count          = 4,
                },
-               .ai             = {
-                       .count          = 32,
-                       .sh_count       = 8,
-                       .diff_count     = 16,
-                       .ex_trig_analog = 1,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
+               .ai_sh_nchan    = 8,
+               .ex_trig_analog = 1,
                .dio_nchan      = 32,
                .has_counter    = 1,
        }, {
@@ -156,12 +140,10 @@ static const struct me4000_board me4000_boards[] = {
                .ao             = {
                        .count          = 4,
                },
-               .ai             = {
-                       .count          = 32,
-                       .sh_count       = 8,
-                       .diff_count     = 16,
-                       .ex_trig_analog = 1,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
+               .ai_sh_nchan    = 8,
+               .ex_trig_analog = 1,
                .dio_nchan      = 32,
                .has_counter    = 1,
        }, {
@@ -171,11 +153,9 @@ static const struct me4000_board me4000_boards[] = {
                        .count          = 4,
                        .fifo_count     = 4,
                },
-               .ai             = {
-                       .count          = 32,
-                       .diff_count     = 16,
-                       .ex_trig_analog = 1,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
+               .ex_trig_analog = 1,
                .dio_nchan      = 32,
                .has_counter    = 1,
        }, {
@@ -185,11 +165,9 @@ static const struct me4000_board me4000_boards[] = {
                        .count          = 4,
                        .fifo_count     = 4,
                },
-               .ai             = {
-                       .count          = 32,
-                       .diff_count     = 16,
-                       .ex_trig_analog = 1,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
+               .ex_trig_analog = 1,
                .dio_nchan      = 32,
                .has_counter    = 1,
        }, {
@@ -199,12 +177,10 @@ static const struct me4000_board me4000_boards[] = {
                        .count          = 4,
                        .fifo_count     = 4,
                },
-               .ai             = {
-                       .count          = 32,
-                       .sh_count       = 8,
-                       .diff_count     = 16,
-                       .ex_trig_analog = 1,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
+               .ai_sh_nchan    = 8,
+               .ex_trig_analog = 1,
                .dio_nchan      = 32,
                .has_counter    = 1,
        }, {
@@ -214,12 +190,10 @@ static const struct me4000_board me4000_boards[] = {
                        .count          = 4,
                        .fifo_count     = 4,
                },
-               .ai             = {
-                       .count          = 32,
-                       .sh_count       = 8,
-                       .diff_count     = 16,
-                       .ex_trig_analog = 1,
-               },
+               .ai_nchan       = 32,
+               .ai_diff_nchan  = 16,
+               .ai_sh_nchan    = 8,
+               .ex_trig_analog = 1,
                .dio_nchan      = 32,
                .has_counter    = 1,
        },
@@ -809,7 +783,7 @@ static int me4000_ai_insn_read(struct comedi_device *dev,
        switch (aref) {
        case AREF_GROUND:
        case AREF_COMMON:
-               if (chan >= thisboard->ai.count) {
+               if (chan >= thisboard->ai_nchan) {
                        printk(KERN_ERR
                               "comedi%d: me4000: me4000_ai_insn_read(): "
                               "Analog input is not available\n", dev->minor);
@@ -827,7 +801,7 @@ static int me4000_ai_insn_read(struct comedi_device *dev,
                        return -EINVAL;
                }
 
-               if (chan >= thisboard->ai.diff_count) {
+               if (chan >= thisboard->ai_diff_nchan) {
                        printk(KERN_ERR
                               "comedi%d: me4000: me4000_ai_insn_read(): "
                               "Analog input is not available\n", dev->minor);
@@ -949,7 +923,7 @@ static int ai_check_chanlist(struct comedi_device *dev,
        if (aref == SDF_DIFF) {
                for (i = 0; i < cmd->chanlist_len; i++) {
                        if (CR_CHAN(cmd->chanlist[i]) >=
-                           thisboard->ai.diff_count) {
+                           thisboard->ai_diff_nchan) {
                                printk(KERN_ERR
                                       "comedi%d: me4000: ai_check_chanlist():"
                                       " Channel number to high\n", dev->minor);
@@ -958,7 +932,7 @@ static int ai_check_chanlist(struct comedi_device *dev,
                }
        } else {
                for (i = 0; i < cmd->chanlist_len; i++) {
-                       if (CR_CHAN(cmd->chanlist[i]) >= thisboard->ai.count) {
+                       if (CR_CHAN(cmd->chanlist[i]) >= thisboard->ai_nchan) {
                                printk(KERN_ERR
                                       "comedi%d: me4000: ai_check_chanlist(): "
                                       "Channel number to high\n", dev->minor);
@@ -2157,11 +2131,11 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
        s = &dev->subdevices[0];
 
-       if (thisboard->ai.count) {
+       if (thisboard->ai_nchan) {
                s->type = COMEDI_SUBD_AI;
                s->subdev_flags =
                    SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF;
-               s->n_chan = thisboard->ai.count;
+               s->n_chan = thisboard->ai_nchan;
                s->maxdata = 0xFFFF;    /*  16 bit ADC */
                s->len_chanlist = ME4000_AI_CHANNEL_LIST_COUNT;
                s->range_table = &me4000_ai_range;
index 12b5c1f1d9b4963d3e45bf983c371d2f61b66944..cbf8c6bd227887074add84c8f690b0006b584909 100644 (file)
@@ -261,18 +261,14 @@ struct me4000_ao_info {
        int fifo_count;
 };
 
-struct me4000_ai_info {
-       int count;
-       int sh_count;
-       int diff_count;
-       int ex_trig_analog;
-};
-
 struct me4000_board {
        const char *name;
        unsigned short device_id;
        struct me4000_ao_info ao;
-       struct me4000_ai_info ai;
+       int ai_nchan;
+       int ai_diff_nchan;
+       int ai_sh_nchan;
+       int ex_trig_analog;
        int dio_nchan;
        int has_counter;
 };