Commit f57b428c authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi_apci_3xxx: remove need for s_EeParameters

The boards supported by this driver do not have an eeprom. Remove the
need for the devpriv->s_EeParameters values by just using the values
from the boardinfo directly.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 56e18770
...@@ -172,13 +172,12 @@ static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, ...@@ -172,13 +172,12 @@ static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev,
/*******************************/ /*******************************/
if (dw_TestReloadValue >= if (dw_TestReloadValue >=
devpriv->s_EeParameters. this_board->ui_MinAcquisitiontimeNs) {
ui_MinAcquisitiontimeNs) {
if ((b_SingleDiff == APCI3XXX_SINGLE) if ((b_SingleDiff == APCI3XXX_SINGLE)
|| (b_SingleDiff == || (b_SingleDiff ==
APCI3XXX_DIFF)) { APCI3XXX_DIFF)) {
if (((b_SingleDiff == APCI3XXX_SINGLE) if (((b_SingleDiff == APCI3XXX_SINGLE)
&& (devpriv->s_EeParameters.i_NbrAiChannel == 0)) && (this_board->i_NbrAiChannel == 0))
|| ((b_SingleDiff == APCI3XXX_DIFF) || ((b_SingleDiff == APCI3XXX_DIFF)
&& (this_board->i_NbrAiChannelDiff == 0)) && (this_board->i_NbrAiChannelDiff == 0))
) { ) {
...@@ -385,7 +384,7 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, ...@@ -385,7 +384,7 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
/* Test the channel number */ /* Test the channel number */
/***************************/ /***************************/
if (((b_Channel < devpriv->s_EeParameters.i_NbrAiChannel) if (((b_Channel < this_board->i_NbrAiChannel)
&& (devpriv->b_SingelDiff == APCI3XXX_SINGLE)) && (devpriv->b_SingelDiff == APCI3XXX_SINGLE))
|| ((b_Channel < this_board->i_NbrAiChannelDiff) || ((b_Channel < this_board->i_NbrAiChannelDiff)
&& (devpriv->b_SingelDiff == APCI3XXX_DIFF))) { && (devpriv->b_SingelDiff == APCI3XXX_DIFF))) {
...@@ -596,6 +595,7 @@ static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, ...@@ -596,6 +595,7 @@ static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
const struct addi_board *board = comedi_board(dev);
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec); unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec);
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
...@@ -611,7 +611,7 @@ static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, ...@@ -611,7 +611,7 @@ static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev,
/* Test the channel number */ /* Test the channel number */
/***************************/ /***************************/
if (b_Channel < devpriv->s_EeParameters.i_NbrAoChannel) { if (b_Channel < board->i_NbrAoChannel) {
/**********************************/ /**********************************/
/* Test the channel configuration */ /* Test the channel configuration */
/**********************************/ /**********************************/
......
...@@ -641,19 +641,6 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, ...@@ -641,19 +641,6 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
devpriv->dw_AiBase = pci_ioremap_bar(pcidev, 3); devpriv->dw_AiBase = pci_ioremap_bar(pcidev, 3);
devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3); devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3);
/* Initialize parameters that can be overridden in EEPROM */
devpriv->s_EeParameters.i_NbrAiChannel = board->i_NbrAiChannel;
devpriv->s_EeParameters.i_NbrAoChannel = board->i_NbrAoChannel;
devpriv->s_EeParameters.i_AiMaxdata = board->i_AiMaxdata;
devpriv->s_EeParameters.i_AoMaxdata = board->i_AoMaxdata;
devpriv->s_EeParameters.i_NbrDiChannel = board->i_NbrDiChannel;
devpriv->s_EeParameters.i_NbrDoChannel = board->i_NbrDoChannel;
devpriv->s_EeParameters.ui_MinAcquisitiontimeNs =
board->ui_MinAcquisitiontimeNs;
devpriv->s_EeParameters.ui_MinDelaytimeNs = board->ui_MinDelaytimeNs;
/* ## */
if (pcidev->irq > 0) { if (pcidev->irq > 0) {
ret = request_irq(pcidev->irq, apci3xxx_irq_handler, ret = request_irq(pcidev->irq, apci3xxx_irq_handler,
IRQF_SHARED, dev->board_name, dev); IRQF_SHARED, dev->board_name, dev);
...@@ -668,20 +655,19 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, ...@@ -668,20 +655,19 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
/* Allocate and Initialise AI Subdevice Structures */ /* Allocate and Initialise AI Subdevice Structures */
s = &dev->subdevices[0]; s = &dev->subdevices[0];
if (devpriv->s_EeParameters.i_NbrAiChannel || if (board->i_NbrAiChannel || board->i_NbrAiChannelDiff) {
board->i_NbrAiChannelDiff) {
dev->read_subdev = s; dev->read_subdev = s;
s->type = COMEDI_SUBD_AI; s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND |
SDF_DIFF; SDF_DIFF;
if (devpriv->s_EeParameters.i_NbrAiChannel) { if (board->i_NbrAiChannel) {
s->n_chan = devpriv->s_EeParameters.i_NbrAiChannel; s->n_chan = board->i_NbrAiChannel;
devpriv->b_SingelDiff = 0; devpriv->b_SingelDiff = 0;
} else { } else {
s->n_chan = board->i_NbrAiChannelDiff; s->n_chan = board->i_NbrAiChannelDiff;
devpriv->b_SingelDiff = 1; devpriv->b_SingelDiff = 1;
} }
s->maxdata = devpriv->s_EeParameters.i_AiMaxdata; s->maxdata = board->i_AiMaxdata;
s->len_chanlist = board->i_AiChannelList; s->len_chanlist = board->i_AiChannelList;
s->range_table = &apci3xxx_ai_range; s->range_table = &apci3xxx_ai_range;
...@@ -702,12 +688,11 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, ...@@ -702,12 +688,11 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
/* Allocate and Initialise AO Subdevice Structures */ /* Allocate and Initialise AO Subdevice Structures */
s = &dev->subdevices[1]; s = &dev->subdevices[1];
if (devpriv->s_EeParameters.i_NbrAoChannel) { if (board->i_NbrAoChannel) {
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
s->n_chan = devpriv->s_EeParameters.i_NbrAoChannel; s->n_chan = board->i_NbrAoChannel;
s->maxdata = devpriv->s_EeParameters.i_AoMaxdata; s->maxdata = board->i_AoMaxdata;
s->len_chanlist = devpriv->s_EeParameters.i_NbrAoChannel;
s->range_table = &apci3xxx_ao_range; s->range_table = &apci3xxx_ao_range;
s->insn_config = board->ao_config; s->insn_config = board->ao_config;
s->insn_write = board->ao_write; s->insn_write = board->ao_write;
...@@ -716,12 +701,11 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, ...@@ -716,12 +701,11 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
} }
/* Allocate and Initialise DI Subdevice Structures */ /* Allocate and Initialise DI Subdevice Structures */
s = &dev->subdevices[2]; s = &dev->subdevices[2];
if (devpriv->s_EeParameters.i_NbrDiChannel) { if (board->i_NbrDiChannel) {
s->type = COMEDI_SUBD_DI; s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON;
s->n_chan = devpriv->s_EeParameters.i_NbrDiChannel; s->n_chan = board->i_NbrDiChannel;
s->maxdata = 1; s->maxdata = 1;
s->len_chanlist = devpriv->s_EeParameters.i_NbrDiChannel;
s->range_table = &range_digital; s->range_table = &range_digital;
s->io_bits = 0; /* all bits input */ s->io_bits = 0; /* all bits input */
s->insn_bits = apci3xxx_di_insn_bits; s->insn_bits = apci3xxx_di_insn_bits;
...@@ -730,13 +714,12 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, ...@@ -730,13 +714,12 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
} }
/* Allocate and Initialise DO Subdevice Structures */ /* Allocate and Initialise DO Subdevice Structures */
s = &dev->subdevices[3]; s = &dev->subdevices[3];
if (devpriv->s_EeParameters.i_NbrDoChannel) { if (board->i_NbrDoChannel) {
s->type = COMEDI_SUBD_DO; s->type = COMEDI_SUBD_DO;
s->subdev_flags = s->subdev_flags =
SDF_READABLE | SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; SDF_READABLE | SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
s->n_chan = devpriv->s_EeParameters.i_NbrDoChannel; s->n_chan = board->i_NbrDoChannel;
s->maxdata = 1; s->maxdata = 1;
s->len_chanlist = devpriv->s_EeParameters.i_NbrDoChannel;
s->range_table = &range_digital; s->range_table = &range_digital;
s->io_bits = 0xf; /* all bits output */ s->io_bits = 0xf; /* all bits output */
s->insn_bits = apci3xxx_do_insn_bits; s->insn_bits = apci3xxx_do_insn_bits;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment