From: H Hartley Sweeten Date: Mon, 14 Jul 2014 19:23:52 +0000 (-0700) Subject: staging: comedi: ni_stc.h: refactor 'adbits' boardinfo X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=db2255f5a0394fc5bc295a4b3e96667c46a7b9ef;p=linux-beck.git staging: comedi: ni_stc.h: refactor 'adbits' boardinfo For aesthetics, change the 'adbits' in the boardinfo to 'ai_maxdata' to remove the need for the calculation of the subdevice 'maxdata'. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c index 0f4dc5afd493..160e703541cc 100644 --- a/drivers/staging/comedi/drivers/ni_atmio.c +++ b/drivers/staging/comedi/drivers/ni_atmio.c @@ -108,7 +108,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 44, .isapnp_id = 0x0000, /* XXX unknown */ .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 8192, .gainlkup = ai_gain_16, .ai_speed = 800, @@ -124,7 +124,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 25, .isapnp_id = 0x1900, .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 2048, .gainlkup = ai_gain_16, .ai_speed = 2000, @@ -140,7 +140,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 36, .isapnp_id = 0x2400, .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .gainlkup = ai_gain_16, .ai_speed = 10000, @@ -155,7 +155,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 37, .isapnp_id = 0x2500, .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .gainlkup = ai_gain_16, .ai_speed = 10000, @@ -171,7 +171,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 38, .isapnp_id = 0x2600, .n_adchan = 64, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 2048, .gainlkup = ai_gain_16, .ai_speed = 2000, @@ -187,7 +187,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 39, .isapnp_id = 0x2700, .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_8, @@ -203,7 +203,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 50, .isapnp_id = 0x0000, /* XXX unknown */ .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_14, @@ -220,7 +220,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 51, .isapnp_id = 0x0000, /* XXX unknown */ .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, /* unknown */ .gainlkup = ai_gain_14, diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 05f51bc1f2df..4c451b5b4a09 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5513,13 +5513,13 @@ static int ni_E_init(struct comedi_device *dev, SDF_READABLE | SDF_DIFF | SDF_DITHER | SDF_CMD_READ; if (!devpriv->is_611x) s->subdev_flags |= SDF_GROUND | SDF_COMMON | SDF_OTHER; - if (board->adbits > 16) + if (board->ai_maxdata > 0xffff) s->subdev_flags |= SDF_LSAMPL; if (devpriv->is_m_series) s->subdev_flags |= SDF_SOFT_CALIBRATED; s->n_chan = board->n_adchan; s->len_chanlist = 512; - s->maxdata = (1 << board->adbits) - 1; + s->maxdata = board->ai_maxdata; s->range_table = ni_range_lkup[board->gainlkup]; s->insn_read = &ni_ai_insn_read; s->insn_config = &ni_ai_insn_config; diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index 815cb2b65c05..bba709d45702 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -56,7 +56,7 @@ static const struct ni_board_struct ni_boards[] = { .name = "DAQCard-ai-16xe-50", .device_id = 0x010d, .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 1024, .gainlkup = ai_gain_8, .ai_speed = 5000, @@ -66,7 +66,7 @@ static const struct ni_board_struct ni_boards[] = { .name = "DAQCard-ai-16e-4", .device_id = 0x010c, .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 1024, .gainlkup = ai_gain_16, .ai_speed = 4000, @@ -76,7 +76,7 @@ static const struct ni_board_struct ni_boards[] = { .name = "DAQCard-6062E", .device_id = 0x02c4, .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 8192, .gainlkup = ai_gain_16, .ai_speed = 2000, @@ -92,7 +92,7 @@ static const struct ni_board_struct ni_boards[] = { .name = "DAQCard-6024E", .device_id = 0x075e, .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 1024, .gainlkup = ai_gain_4, .ai_speed = 5000, @@ -107,7 +107,7 @@ static const struct ni_board_struct ni_boards[] = { .name = "DAQCard-6036E", .device_id = 0x0245, .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 1024, .alwaysdither = 1, .gainlkup = ai_gain_4, diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 1095f3f32c92..394fd2bb76ca 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -211,7 +211,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCIMIO_16XE_50] = { .name = "pci-mio-16xe-50", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 2048, .alwaysdither = 1, .gainlkup = ai_gain_8, @@ -226,7 +226,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCIMIO_16XE_10] = { .name = "pci-mio-16xe-10", /* aka pci-6030E */ .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_14, @@ -242,7 +242,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6014] = { .name = "pci-6014", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_4, @@ -257,7 +257,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6030E] = { .name = "pxi-6030e", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_14, @@ -273,7 +273,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCIMIO_16E_1] = { .name = "pci-mio-16e-1", /* aka pci-6070e */ .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .gainlkup = ai_gain_16, .ai_speed = 800, @@ -288,7 +288,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCIMIO_16E_4] = { .name = "pci-mio-16e-4", /* aka pci-6040e */ .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .gainlkup = ai_gain_16, /* @@ -307,7 +307,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6040E] = { .name = "pxi-6040e", .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .gainlkup = ai_gain_16, .ai_speed = 2000, @@ -322,7 +322,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6031E] = { .name = "pci-6031e", .n_adchan = 64, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_14, @@ -338,7 +338,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6032E] = { .name = "pci-6032e", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_14, @@ -349,7 +349,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6033E] = { .name = "pci-6033e", .n_adchan = 64, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_14, @@ -360,7 +360,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6071E] = { .name = "pci-6071e", .n_adchan = 64, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_16, @@ -376,7 +376,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6023E] = { .name = "pci-6023e", .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .gainlkup = ai_gain_4, .ai_speed = 5000, @@ -386,7 +386,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6024E] = { .name = "pci-6024e", .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .gainlkup = ai_gain_4, .ai_speed = 5000, @@ -400,7 +400,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6025E] = { .name = "pci-6025e", .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .gainlkup = ai_gain_4, .ai_speed = 5000, @@ -415,7 +415,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6025E] = { .name = "pxi-6025e", .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .gainlkup = ai_gain_4, .ai_speed = 5000, @@ -430,7 +430,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6034E] = { .name = "pci-6034e", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_4, @@ -441,7 +441,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6035E] = { .name = "pci-6035e", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_4, @@ -456,7 +456,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6052E] = { .name = "pci-6052e", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_16, @@ -473,7 +473,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6110] = { .name = "pci-6110", .n_adchan = 4, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 8192, .alwaysdither = 0, .gainlkup = ai_gain_611x, @@ -490,7 +490,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6111] = { .name = "pci-6111", .n_adchan = 2, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 8192, .gainlkup = ai_gain_611x, .ai_speed = 200, @@ -508,7 +508,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6115] = { /* .device_id = 0x2ed0, */ .name = "pci-6115", .n_adchan = 4, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 8192, .gainlkup = ai_gain_611x, .ai_speed = 100, @@ -527,7 +527,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6115] = { /* .device_id = ????, */ .name = "pxi-6115", .n_adchan = 4, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 8192, .gainlkup = ai_gain_611x, .ai_speed = 100, @@ -635,7 +635,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6071E] = { .name = "pxi-6071e", .n_adchan = 64, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_16, @@ -651,7 +651,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6070E] = { .name = "pxi-6070e", .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_16, @@ -667,7 +667,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6052E] = { .name = "pxi-6052e", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_16, @@ -683,7 +683,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6031E] = { .name = "pxi-6031e", .n_adchan = 64, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_14, @@ -699,7 +699,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6036E] = { .name = "pci-6036e", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_4, @@ -714,7 +714,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6220] = { .name = "pci-6220", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 512, /* FIXME: guess */ .gainlkup = ai_gain_622x, .ai_speed = 4000, @@ -725,7 +725,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6221] = { .name = "pci-6221", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_622x, .ai_speed = 4000, @@ -741,7 +741,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6221_37PIN] = { .name = "pci-6221_37pin", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_622x, .ai_speed = 4000, @@ -757,7 +757,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6224] = { .name = "pci-6224", .n_adchan = 32, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_622x, .ai_speed = 4000, @@ -768,7 +768,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6224] = { .name = "pxi-6224", .n_adchan = 32, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_622x, .ai_speed = 4000, @@ -779,7 +779,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6225] = { .name = "pci-6225", .n_adchan = 80, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_622x, .ai_speed = 4000, @@ -795,7 +795,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6225] = { .name = "pxi-6225", .n_adchan = 80, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_622x, .ai_speed = 4000, @@ -811,7 +811,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6229] = { .name = "pci-6229", .n_adchan = 32, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_622x, .ai_speed = 4000, @@ -827,7 +827,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6250] = { .name = "pci-6250", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_628x, .ai_speed = 800, @@ -838,7 +838,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6251] = { .name = "pci-6251", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_628x, .ai_speed = 800, @@ -854,7 +854,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCIE6251] = { .name = "pcie-6251", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_628x, .ai_speed = 800, @@ -870,7 +870,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXIE6251] = { .name = "pxie-6251", .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_628x, .ai_speed = 800, @@ -886,7 +886,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6254] = { .name = "pci-6254", .n_adchan = 32, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_628x, .ai_speed = 800, @@ -897,7 +897,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6259] = { .name = "pci-6259", .n_adchan = 32, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_628x, .ai_speed = 800, @@ -913,7 +913,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCIE6259] = { .name = "pcie-6259", .n_adchan = 32, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 4095, .gainlkup = ai_gain_628x, .ai_speed = 800, @@ -929,7 +929,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6280] = { .name = "pci-6280", .n_adchan = 16, - .adbits = 18, + .ai_maxdata = 0x3ffff, .ai_fifo_depth = 2047, .gainlkup = ai_gain_628x, .ai_speed = 1600, @@ -941,7 +941,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6281] = { .name = "pci-6281", .n_adchan = 16, - .adbits = 18, + .ai_maxdata = 0x3ffff, .ai_fifo_depth = 2047, .gainlkup = ai_gain_628x, .ai_speed = 1600, @@ -957,7 +957,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6281] = { .name = "pxi-6281", .n_adchan = 16, - .adbits = 18, + .ai_maxdata = 0x3ffff, .ai_fifo_depth = 2047, .gainlkup = ai_gain_628x, .ai_speed = 1600, @@ -973,7 +973,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6284] = { .name = "pci-6284", .n_adchan = 32, - .adbits = 18, + .ai_maxdata = 0x3ffff, .ai_fifo_depth = 2047, .gainlkup = ai_gain_628x, .ai_speed = 1600, @@ -984,7 +984,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6289] = { .name = "pci-6289", .n_adchan = 32, - .adbits = 18, + .ai_maxdata = 0x3ffff, .ai_fifo_depth = 2047, .gainlkup = ai_gain_628x, .ai_speed = 1600, @@ -1000,7 +1000,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PCI6143] = { .name = "pci-6143", .n_adchan = 8, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 1024, .gainlkup = ai_gain_6143, .ai_speed = 4000, @@ -1011,7 +1011,7 @@ static const struct ni_board_struct ni_boards[] = { [BOARD_PXI6143] = { .name = "pxi-6143", .n_adchan = 8, - .adbits = 16, + .ai_maxdata = 0xffff, .ai_fifo_depth = 1024, .gainlkup = ai_gain_6143, .ai_speed = 4000, diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h index 6f9c4811e231..ceae7e18c274 100644 --- a/drivers/staging/comedi/drivers/ni_stc.h +++ b/drivers/staging/comedi/drivers/ni_stc.h @@ -1393,7 +1393,7 @@ struct ni_board_struct { int isapnp_id; int n_adchan; - int adbits; + unsigned int ai_maxdata; int ai_fifo_depth; unsigned int alwaysdither:1;