staging: comedi: addi_apci_3120: 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: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4ee6d2743a
commit
48fdf08418
|
@ -257,6 +257,7 @@ static int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev,
|
|||
struct comedi_insn *insn,
|
||||
unsigned int *data)
|
||||
{
|
||||
const struct addi_board *this_board = comedi_board(dev);
|
||||
struct addi_private *devpriv = dev->private;
|
||||
unsigned int i;
|
||||
|
||||
|
@ -272,7 +273,7 @@ static int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev,
|
|||
for (i = 0; i < data[3]; i++) {
|
||||
|
||||
if (CR_CHAN(data[4 + i]) >=
|
||||
devpriv->s_EeParameters.i_NbrAiChannel) {
|
||||
this_board->i_NbrAiChannel) {
|
||||
printk("bad channel list\n");
|
||||
return -2;
|
||||
}
|
||||
|
@ -743,7 +744,6 @@ static int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev,
|
|||
struct comedi_cmd *cmd)
|
||||
{
|
||||
const struct addi_board *this_board = comedi_board(dev);
|
||||
struct addi_private *devpriv = dev->private;
|
||||
int err = 0;
|
||||
|
||||
/* Step 1 : check if triggers are trivially valid */
|
||||
|
@ -778,9 +778,9 @@ static int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev,
|
|||
|
||||
if (cmd->scan_begin_src == TRIG_TIMER) { /* Test Delay timing */
|
||||
if (cmd->scan_begin_arg <
|
||||
devpriv->s_EeParameters.ui_MinDelaytimeNs) {
|
||||
this_board->ui_MinDelaytimeNs) {
|
||||
cmd->scan_begin_arg =
|
||||
devpriv->s_EeParameters.ui_MinDelaytimeNs;
|
||||
this_board->ui_MinDelaytimeNs;
|
||||
err++;
|
||||
}
|
||||
}
|
||||
|
@ -789,18 +789,16 @@ static int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev,
|
|||
if (cmd->scan_begin_src == TRIG_TIMER) {
|
||||
if ((cmd->convert_arg)
|
||||
&& (cmd->convert_arg <
|
||||
devpriv->s_EeParameters.
|
||||
ui_MinAcquisitiontimeNs)) {
|
||||
cmd->convert_arg = devpriv->s_EeParameters.
|
||||
ui_MinAcquisitiontimeNs;
|
||||
this_board->ui_MinAcquisitiontimeNs)) {
|
||||
cmd->convert_arg =
|
||||
this_board->ui_MinAcquisitiontimeNs;
|
||||
err++;
|
||||
}
|
||||
} else {
|
||||
if (cmd->convert_arg <
|
||||
devpriv->s_EeParameters.ui_MinAcquisitiontimeNs
|
||||
) {
|
||||
cmd->convert_arg = devpriv->s_EeParameters.
|
||||
ui_MinAcquisitiontimeNs;
|
||||
this_board->ui_MinAcquisitiontimeNs) {
|
||||
cmd->convert_arg =
|
||||
this_board->ui_MinAcquisitiontimeNs;
|
||||
err++;
|
||||
|
||||
}
|
||||
|
@ -2290,9 +2288,10 @@ static int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device *dev,
|
|||
struct comedi_insn *insn,
|
||||
unsigned int *data)
|
||||
{
|
||||
const struct addi_board *this_board = comedi_board(dev);
|
||||
struct addi_private *devpriv = dev->private;
|
||||
|
||||
if ((data[0] > devpriv->s_EeParameters.i_DoMaxdata) || (data[0] < 0)) {
|
||||
if ((data[0] > this_board->i_DoMaxdata) || (data[0] < 0)) {
|
||||
|
||||
comedi_error(dev, "Data is not valid !!! \n");
|
||||
return -EINVAL;
|
||||
|
@ -2330,6 +2329,7 @@ static int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev,
|
|||
struct comedi_insn *insn,
|
||||
unsigned int *data)
|
||||
{
|
||||
const struct addi_board *this_board = comedi_board(dev);
|
||||
struct addi_private *devpriv = dev->private;
|
||||
unsigned int ui_Temp1;
|
||||
unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */
|
||||
|
@ -2339,7 +2339,7 @@ static int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev,
|
|||
"Not a valid Data !!! ,Data should be 1 or 0\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ui_NoOfChannel > devpriv->s_EeParameters.i_NbrDoChannel - 1) {
|
||||
if (ui_NoOfChannel > this_board->i_NbrDoChannel - 1) {
|
||||
comedi_error(dev,
|
||||
"This board doesn't have specified channel !!! \n");
|
||||
return -EINVAL;
|
||||
|
|
|
@ -157,23 +157,6 @@ static int apci3120_attach_pci(struct comedi_device *dev,
|
|||
devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2);
|
||||
devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3);
|
||||
|
||||
/* Initialize parameters that can be overridden in EEPROM */
|
||||
devpriv->s_EeParameters.i_NbrAiChannel = this_board->i_NbrAiChannel;
|
||||
devpriv->s_EeParameters.i_NbrAoChannel = this_board->i_NbrAoChannel;
|
||||
devpriv->s_EeParameters.i_AiMaxdata = this_board->i_AiMaxdata;
|
||||
devpriv->s_EeParameters.i_AoMaxdata = this_board->i_AoMaxdata;
|
||||
devpriv->s_EeParameters.i_NbrDiChannel = this_board->i_NbrDiChannel;
|
||||
devpriv->s_EeParameters.i_NbrDoChannel = this_board->i_NbrDoChannel;
|
||||
devpriv->s_EeParameters.i_DoMaxdata = this_board->i_DoMaxdata;
|
||||
devpriv->s_EeParameters.i_Dma = this_board->i_Dma;
|
||||
devpriv->s_EeParameters.i_Timer = this_board->i_Timer;
|
||||
devpriv->s_EeParameters.ui_MinAcquisitiontimeNs =
|
||||
this_board->ui_MinAcquisitiontimeNs;
|
||||
devpriv->s_EeParameters.ui_MinDelaytimeNs =
|
||||
this_board->ui_MinDelaytimeNs;
|
||||
|
||||
/* ## */
|
||||
|
||||
if (pcidev->irq > 0) {
|
||||
ret = request_irq(pcidev->irq, v_ADDI_Interrupt, IRQF_SHARED,
|
||||
dev->board_name, dev);
|
||||
|
@ -183,7 +166,7 @@ static int apci3120_attach_pci(struct comedi_device *dev,
|
|||
|
||||
devpriv->us_UseDma = ADDI_ENABLE;
|
||||
|
||||
if (devpriv->s_EeParameters.i_Dma) {
|
||||
if (this_board->i_Dma) {
|
||||
if (devpriv->us_UseDma == ADDI_ENABLE) {
|
||||
/* alloc DMA buffers */
|
||||
devpriv->b_DmaDoubleBuffer = 0;
|
||||
|
@ -222,22 +205,20 @@ static int apci3120_attach_pci(struct comedi_device *dev,
|
|||
|
||||
/* Allocate and Initialise AI Subdevice Structures */
|
||||
s = &dev->subdevices[0];
|
||||
if ((devpriv->s_EeParameters.i_NbrAiChannel)
|
||||
|| (this_board->i_NbrAiChannelDiff)) {
|
||||
if (this_board->i_NbrAiChannel || (this_board->i_NbrAiChannelDiff)) {
|
||||
dev->read_subdev = s;
|
||||
s->type = COMEDI_SUBD_AI;
|
||||
s->subdev_flags =
|
||||
SDF_READABLE | SDF_COMMON | SDF_GROUND
|
||||
| SDF_DIFF;
|
||||
if (devpriv->s_EeParameters.i_NbrAiChannel) {
|
||||
s->n_chan =
|
||||
devpriv->s_EeParameters.i_NbrAiChannel;
|
||||
if (this_board->i_NbrAiChannel) {
|
||||
s->n_chan = this_board->i_NbrAiChannel;
|
||||
devpriv->b_SingelDiff = 0;
|
||||
} else {
|
||||
s->n_chan = this_board->i_NbrAiChannelDiff;
|
||||
devpriv->b_SingelDiff = 1;
|
||||
}
|
||||
s->maxdata = devpriv->s_EeParameters.i_AiMaxdata;
|
||||
s->maxdata = this_board->i_AiMaxdata;
|
||||
s->len_chanlist = this_board->i_AiChannelList;
|
||||
s->range_table = this_board->pr_AiRangelist;
|
||||
|
||||
|
@ -258,13 +239,12 @@ static int apci3120_attach_pci(struct comedi_device *dev,
|
|||
|
||||
/* Allocate and Initialise AO Subdevice Structures */
|
||||
s = &dev->subdevices[1];
|
||||
if (devpriv->s_EeParameters.i_NbrAoChannel) {
|
||||
if (this_board->i_NbrAoChannel) {
|
||||
s->type = COMEDI_SUBD_AO;
|
||||
s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
|
||||
s->n_chan = devpriv->s_EeParameters.i_NbrAoChannel;
|
||||
s->maxdata = devpriv->s_EeParameters.i_AoMaxdata;
|
||||
s->len_chanlist =
|
||||
devpriv->s_EeParameters.i_NbrAoChannel;
|
||||
s->n_chan = this_board->i_NbrAoChannel;
|
||||
s->maxdata = this_board->i_AoMaxdata;
|
||||
s->len_chanlist = this_board->i_NbrAoChannel;
|
||||
s->range_table = this_board->pr_AoRangelist;
|
||||
s->insn_config = this_board->ao_config;
|
||||
s->insn_write = this_board->ao_write;
|
||||
|
@ -273,13 +253,12 @@ static int apci3120_attach_pci(struct comedi_device *dev,
|
|||
}
|
||||
/* Allocate and Initialise DI Subdevice Structures */
|
||||
s = &dev->subdevices[2];
|
||||
if (devpriv->s_EeParameters.i_NbrDiChannel) {
|
||||
if (this_board->i_NbrDiChannel) {
|
||||
s->type = COMEDI_SUBD_DI;
|
||||
s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON;
|
||||
s->n_chan = devpriv->s_EeParameters.i_NbrDiChannel;
|
||||
s->n_chan = this_board->i_NbrDiChannel;
|
||||
s->maxdata = 1;
|
||||
s->len_chanlist =
|
||||
devpriv->s_EeParameters.i_NbrDiChannel;
|
||||
s->len_chanlist = this_board->i_NbrDiChannel;
|
||||
s->range_table = &range_digital;
|
||||
s->io_bits = 0; /* all bits input */
|
||||
s->insn_config = this_board->di_config;
|
||||
|
@ -291,14 +270,13 @@ static int apci3120_attach_pci(struct comedi_device *dev,
|
|||
}
|
||||
/* Allocate and Initialise DO Subdevice Structures */
|
||||
s = &dev->subdevices[3];
|
||||
if (devpriv->s_EeParameters.i_NbrDoChannel) {
|
||||
if (this_board->i_NbrDoChannel) {
|
||||
s->type = COMEDI_SUBD_DO;
|
||||
s->subdev_flags =
|
||||
SDF_READABLE | SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
|
||||
s->n_chan = devpriv->s_EeParameters.i_NbrDoChannel;
|
||||
s->maxdata = devpriv->s_EeParameters.i_DoMaxdata;
|
||||
s->len_chanlist =
|
||||
devpriv->s_EeParameters.i_NbrDoChannel;
|
||||
s->n_chan = this_board->i_NbrDoChannel;
|
||||
s->maxdata = this_board->i_DoMaxdata;
|
||||
s->len_chanlist = this_board->i_NbrDoChannel;
|
||||
s->range_table = &range_digital;
|
||||
s->io_bits = 0xf; /* all bits output */
|
||||
|
||||
|
@ -313,7 +291,7 @@ static int apci3120_attach_pci(struct comedi_device *dev,
|
|||
|
||||
/* Allocate and Initialise Timer Subdevice Structures */
|
||||
s = &dev->subdevices[4];
|
||||
if (devpriv->s_EeParameters.i_Timer) {
|
||||
if (this_board->i_Timer) {
|
||||
s->type = COMEDI_SUBD_TIMER;
|
||||
s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
|
||||
s->n_chan = 1;
|
||||
|
|
Loading…
Reference in New Issue