staging: comedi: adv_pci1710: remove boardinfo 'rangelist_ao'
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 20 Jan 2015 21:53:18 +0000 (14:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Jan 2015 11:59:12 +0000 (19:59 +0800)
This boardinfo is not necessary. All the boards with analog outputs have
the same range options except for the pci1720 board. That board type is
already handled specially during the driver attach.

Remove the boardinfo and add the subdevice range_table initialization in
the cardtype switch.

Rename the range tables to clarify that they are "analog output" ranges.

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

index 2017285372a9b1ece67260bcdb4a9c1a8d91e55d..62c2a51572668f6a615269bca2d117eb24ff304a 100644 (file)
@@ -164,7 +164,7 @@ static const struct comedi_lrange range_pci17x1 = {
 
 static const char range_codes_pci17x1[] = { 0x00, 0x01, 0x02, 0x03, 0x04 };
 
-static const struct comedi_lrange range_pci1720 = {
+static const struct comedi_lrange pci1720_ao_range = {
        4, {
                UNI_RANGE(5),
                UNI_RANGE(10),
@@ -173,7 +173,7 @@ static const struct comedi_lrange range_pci1720 = {
        }
 };
 
-static const struct comedi_lrange range_pci171x_da = {
+static const struct comedi_lrange pci171x_ao_range = {
        2, {
                UNI_RANGE(5),
                UNI_RANGE(10)
@@ -195,7 +195,6 @@ struct boardtype {
        int n_aichan;           /*  num of A/D chans */
        const struct comedi_lrange *rangelist_ai;       /*  rangelist for A/D */
        const char *rangecode_ai;       /*  range codes for programming */
-       const struct comedi_lrange *rangelist_ao;       /*  rangelist for D/A */
        unsigned int has_irq:1;
        unsigned int has_large_fifo:1;  /* 4K or 1K FIFO */
        unsigned int has_diff_ai:1;
@@ -211,7 +210,6 @@ static const struct boardtype boardtypes[] = {
                .n_aichan       = 16,
                .rangelist_ai   = &range_pci1710_3,
                .rangecode_ai   = range_codes_pci1710_3,
-               .rangelist_ao   = &range_pci171x_da,
                .has_irq        = 1,
                .has_large_fifo = 1,
                .has_diff_ai    = 1,
@@ -225,7 +223,6 @@ static const struct boardtype boardtypes[] = {
                .n_aichan       = 16,
                .rangelist_ai   = &range_pci1710hg,
                .rangecode_ai   = range_codes_pci1710hg,
-               .rangelist_ao   = &range_pci171x_da,
                .has_irq        = 1,
                .has_large_fifo = 1,
                .has_diff_ai    = 1,
@@ -239,7 +236,6 @@ static const struct boardtype boardtypes[] = {
                .n_aichan       = 16,
                .rangelist_ai   = &range_pci17x1,
                .rangecode_ai   = range_codes_pci17x1,
-               .rangelist_ao   = &range_pci171x_da,
                .has_irq        = 1,
                .has_ao         = 1,
                .has_di_do      = 1,
@@ -258,7 +254,6 @@ static const struct boardtype boardtypes[] = {
        [BOARD_PCI1720] = {
                .name           = "pci1720",
                .cardtype       = TYPE_PCI1720,
-               .rangelist_ao   = &range_pci1720,
                .has_ao         = 1,
        },
        [BOARD_PCI1731] = {
@@ -1071,14 +1066,15 @@ static int pci1710_auto_attach(struct comedi_device *dev,
                s->type         = COMEDI_SUBD_AO;
                s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
                s->maxdata      = 0x0fff;
-               s->range_table  = board->rangelist_ao;
                switch (board->cardtype) {
                case TYPE_PCI1720:
                        s->n_chan       = 4;
+                       s->range_table  = &pci1720_ao_range;
                        s->insn_write   = pci1720_ao_insn_write;
                        break;
                default:
                        s->n_chan       = 2;
+                       s->range_table  = &pci171x_ao_range;
                        s->insn_write   = pci171x_ao_insn_write;
                        break;
                }