staging: comedi: ni_stc.h: refactor 'aobits' boardinfo
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 14 Jul 2014 19:23:53 +0000 (12:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jul 2014 20:24:43 +0000 (13:24 -0700)
For aesthetics, change the 'aobits' in the boardinfo to 'ao_maxdata'
to remove the need for the calculation of the subdevice 'maxdata'.

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/ni_atmio.c
drivers/staging/comedi/drivers/ni_mio_common.c
drivers/staging/comedi/drivers/ni_mio_cs.c
drivers/staging/comedi/drivers/ni_pcimio.c
drivers/staging/comedi/drivers/ni_stc.h

index 160e703..3858061 100644 (file)
@@ -113,7 +113,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 800,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 1000,
@@ -129,7 +129,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 2000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 1000,
@@ -145,7 +145,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 10000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 10000,
                .num_p0_dio_channels = 8,
@@ -160,7 +160,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 10000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 10000,
                .num_p0_dio_channels = 8,
@@ -176,7 +176,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 2000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 1000,
@@ -193,7 +193,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_8,
                .ai_speed       = 50000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 50000,
                .num_p0_dio_channels = 8,
@@ -209,7 +209,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_14,
                .ai_speed       = 10000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 1000,
index 4c451b5..8303d66 100644 (file)
@@ -5544,7 +5544,7 @@ static int ni_E_init(struct comedi_device *dev,
                if (devpriv->is_m_series)
                        s->subdev_flags |= SDF_SOFT_CALIBRATED;
                s->n_chan = board->n_aochan;
-               s->maxdata = (1 << board->aobits) - 1;
+               s->maxdata = board->ao_maxdata;
                s->range_table = board->ao_range_table;
                s->insn_read = &ni_ao_insn_read;
                s->insn_write = &ni_ao_insn_write;
index bba709d..bb414ec 100644 (file)
@@ -81,7 +81,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 2000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 1176,
@@ -97,7 +97,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_4,
                .ai_speed       = 5000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 1000000,
                .num_p0_dio_channels = 8,
@@ -113,7 +113,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_4,
                .ai_speed       = 5000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 1000000,
                .num_p0_dio_channels = 8,
@@ -124,7 +124,7 @@ static const struct ni_board_struct ni_boards[] = {
                .name           = "DAQCard-6715",
                .device_id      = 0x0000,       /* unknown */
                .n_aochan       = 8,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_671x        = 8192,
                .num_p0_dio_channels = 8,
                .caldac         = { mb88341, mb88341 },
index 394fd2b..8261cf7 100644 (file)
@@ -217,7 +217,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_8,
                .ai_speed       = 50000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 50000,
                .num_p0_dio_channels = 8,
@@ -232,7 +232,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_14,
                .ai_speed       = 10000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 10000,
@@ -248,7 +248,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_4,
                .ai_speed       = 5000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 100000,
                .num_p0_dio_channels = 8,
@@ -263,7 +263,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_14,
                .ai_speed       = 10000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 10000,
@@ -278,7 +278,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 800,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 1000,
@@ -297,7 +297,7 @@ static const struct ni_board_struct ni_boards[] = {
                 */
                .ai_speed       = 2000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 512,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 1000,
@@ -312,7 +312,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 2000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 512,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 1000,
@@ -328,7 +328,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_14,
                .ai_speed       = 10000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 10000,
@@ -366,7 +366,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 800,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 1000,
@@ -391,7 +391,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_4,
                .ai_speed       = 5000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 100000,
                .num_p0_dio_channels = 8,
@@ -405,7 +405,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_4,
                .ai_speed       = 5000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 100000,
                .num_p0_dio_channels = 8,
@@ -420,7 +420,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_4,
                .ai_speed       = 5000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 100000,
                .num_p0_dio_channels = 8,
@@ -447,7 +447,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_4,
                .ai_speed       = 5000,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 100000,
                .num_p0_dio_channels = 8,
@@ -462,7 +462,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 3000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 3000,
@@ -479,7 +479,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_611x,
                .ai_speed       = 200,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .reg_type       = ni_reg_611x,
                .ao_range_table = &range_bipolar10,
                .ao_fifo_depth  = 2048,
@@ -495,7 +495,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_611x,
                .ai_speed       = 200,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .reg_type       = ni_reg_611x,
                .ao_range_table = &range_bipolar10,
                .ao_fifo_depth  = 2048,
@@ -513,7 +513,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_611x,
                .ai_speed       = 100,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_671x        = 1,
                .ao_fifo_depth  = 2048,
                .ao_speed       = 250,
@@ -532,7 +532,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_611x,
                .ai_speed       = 100,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_671x        = 1,
                .ao_fifo_depth  = 2048,
                .ao_speed       = 250,
@@ -545,7 +545,7 @@ static const struct ni_board_struct ni_boards[] = {
        [BOARD_PCI6711] = {
                .name = "pci-6711",
                .n_aochan       = 4,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                /* data sheet says 8192, but fifo really holds 16384 samples */
                .ao_fifo_depth  = 16384,
                .ao_range_table = &range_bipolar10,
@@ -557,7 +557,7 @@ static const struct ni_board_struct ni_boards[] = {
        [BOARD_PXI6711] = {
                .name           = "pxi-6711",
                .n_aochan       = 4,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 16384,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 1000,
@@ -568,7 +568,7 @@ static const struct ni_board_struct ni_boards[] = {
        [BOARD_PCI6713] = {
                .name           = "pci-6713",
                .n_aochan       = 8,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 16384,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 1000,
@@ -579,7 +579,7 @@ static const struct ni_board_struct ni_boards[] = {
        [BOARD_PXI6713] = {
                .name           = "pxi-6713",
                .n_aochan       = 8,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 16384,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 1000,
@@ -590,7 +590,7 @@ static const struct ni_board_struct ni_boards[] = {
        [BOARD_PCI6731] = {
                .name           = "pci-6731",
                .n_aochan       = 4,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8192,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 1000,
@@ -602,7 +602,7 @@ static const struct ni_board_struct ni_boards[] = {
        [BOARD_PXI6731] = {     /* .device_id = ????, */
                .name           = "pxi-6731",
                .n_aochan       = 4,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8192,
                .ao_range_table = &range_bipolar10,
                .num_p0_dio_channels = 8,
@@ -613,7 +613,7 @@ static const struct ni_board_struct ni_boards[] = {
        [BOARD_PCI6733] = {
                .name           = "pci-6733",
                .n_aochan       = 8,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 16384,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 1000,
@@ -624,7 +624,7 @@ static const struct ni_board_struct ni_boards[] = {
        [BOARD_PXI6733] = {
                .name           = "pxi-6733",
                .n_aochan       = 8,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 16384,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 1000,
@@ -641,7 +641,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 800,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 1000,
@@ -657,7 +657,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 800,
                .n_aochan       = 2,
-               .aobits         = 12,
+               .ao_maxdata     = 0x0fff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 1000,
@@ -673,7 +673,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_16,
                .ai_speed       = 3000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 3000,
@@ -689,7 +689,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_14,
                .ai_speed       = 10000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 2048,
                .ao_range_table = &range_ni_E_ao_ext,
                .ao_speed       = 10000,
@@ -705,7 +705,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_4,
                .ai_speed       = 5000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_range_table = &range_bipolar10,
                .ao_speed       = 100000,
                .num_p0_dio_channels = 8,
@@ -730,7 +730,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_622x,
                .ai_speed       = 4000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_bipolar10,
                .reg_type       = ni_reg_622x,
@@ -746,7 +746,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_622x,
                .ai_speed       = 4000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_bipolar10,
                .reg_type       = ni_reg_622x,
@@ -784,7 +784,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_622x,
                .ai_speed       = 4000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_bipolar10,
                .reg_type       = ni_reg_622x,
@@ -800,7 +800,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_622x,
                .ai_speed       = 4000,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_bipolar10,
                .reg_type       = ni_reg_622x,
@@ -816,7 +816,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_622x,
                .ai_speed       = 4000,
                .n_aochan       = 4,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_bipolar10,
                .reg_type       = ni_reg_622x,
@@ -843,7 +843,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_628x,
                .ai_speed       = 800,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_ni_M_625x_ao,
                .reg_type       = ni_reg_625x,
@@ -859,7 +859,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_628x,
                .ai_speed       = 800,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_ni_M_625x_ao,
                .reg_type       = ni_reg_625x,
@@ -875,7 +875,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_628x,
                .ai_speed       = 800,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_ni_M_625x_ao,
                .reg_type       = ni_reg_625x,
@@ -902,7 +902,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_628x,
                .ai_speed       = 800,
                .n_aochan       = 4,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_ni_M_625x_ao,
                .reg_type       = ni_reg_625x,
@@ -918,7 +918,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_628x,
                .ai_speed       = 800,
                .n_aochan       = 4,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_ni_M_625x_ao,
                .reg_type       = ni_reg_625x,
@@ -946,7 +946,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_628x,
                .ai_speed       = 1600,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_ni_M_628x_ao,
                .reg_type       = ni_reg_628x,
@@ -962,7 +962,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_628x,
                .ai_speed       = 1600,
                .n_aochan       = 2,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_ni_M_628x_ao,
                .reg_type       = ni_reg_628x,
@@ -989,7 +989,7 @@ static const struct ni_board_struct ni_boards[] = {
                .gainlkup       = ai_gain_628x,
                .ai_speed       = 1600,
                .n_aochan       = 4,
-               .aobits         = 16,
+               .ao_maxdata     = 0xffff,
                .ao_fifo_depth  = 8191,
                .ao_range_table = &range_ni_M_628x_ao,
                .reg_type       = ni_reg_628x,
index ceae7e1..b3faed5 100644 (file)
@@ -1401,7 +1401,7 @@ struct ni_board_struct {
        int ai_speed;
 
        int n_aochan;
-       int aobits;
+       unsigned int ao_maxdata;
        int ao_fifo_depth;
        const struct comedi_lrange *ao_range_table;
        unsigned ao_speed;