From f57b428c006486c951188354732b469b4b4a1af7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 12 Jun 2013 16:09:29 -0700 Subject: [PATCH] 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: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3xxx.c | 10 ++--- .../staging/comedi/drivers/addi_apci_3xxx.c | 39 ++++++------------- 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c index b493d0c9e46c..08dce6095294 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c @@ -172,13 +172,12 @@ static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, /*******************************/ if (dw_TestReloadValue >= - devpriv->s_EeParameters. - ui_MinAcquisitiontimeNs) { + this_board->ui_MinAcquisitiontimeNs) { if ((b_SingleDiff == APCI3XXX_SINGLE) || (b_SingleDiff == APCI3XXX_DIFF)) { if (((b_SingleDiff == APCI3XXX_SINGLE) - && (devpriv->s_EeParameters.i_NbrAiChannel == 0)) + && (this_board->i_NbrAiChannel == 0)) || ((b_SingleDiff == APCI3XXX_DIFF) && (this_board->i_NbrAiChannelDiff == 0)) ) { @@ -385,7 +384,7 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, /* Test the channel number */ /***************************/ - if (((b_Channel < devpriv->s_EeParameters.i_NbrAiChannel) + if (((b_Channel < this_board->i_NbrAiChannel) && (devpriv->b_SingelDiff == APCI3XXX_SINGLE)) || ((b_Channel < this_board->i_NbrAiChannelDiff) && (devpriv->b_SingelDiff == APCI3XXX_DIFF))) { @@ -596,6 +595,7 @@ static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { + const struct addi_board *board = comedi_board(dev); struct addi_private *devpriv = dev->private; unsigned char b_Range = (unsigned char) CR_RANGE(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, /* Test the channel number */ /***************************/ - if (b_Channel < devpriv->s_EeParameters.i_NbrAoChannel) { + if (b_Channel < board->i_NbrAoChannel) { /**********************************/ /* Test the channel configuration */ /**********************************/ diff --git a/drivers/staging/comedi/drivers/addi_apci_3xxx.c b/drivers/staging/comedi/drivers/addi_apci_3xxx.c index 7897a5129c8d..f7c95ae66c56 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3xxx.c +++ b/drivers/staging/comedi/drivers/addi_apci_3xxx.c @@ -641,19 +641,6 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, devpriv->dw_AiBase = pci_ioremap_bar(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) { ret = request_irq(pcidev->irq, apci3xxx_irq_handler, IRQF_SHARED, dev->board_name, dev); @@ -668,20 +655,19 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, /* Allocate and Initialise AI Subdevice Structures */ s = &dev->subdevices[0]; - if (devpriv->s_EeParameters.i_NbrAiChannel || - board->i_NbrAiChannelDiff) { + if (board->i_NbrAiChannel || 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 (board->i_NbrAiChannel) { + s->n_chan = board->i_NbrAiChannel; devpriv->b_SingelDiff = 0; } else { s->n_chan = board->i_NbrAiChannelDiff; devpriv->b_SingelDiff = 1; } - s->maxdata = devpriv->s_EeParameters.i_AiMaxdata; + s->maxdata = board->i_AiMaxdata; s->len_chanlist = board->i_AiChannelList; s->range_table = &apci3xxx_ai_range; @@ -702,12 +688,11 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, /* Allocate and Initialise AO Subdevice Structures */ s = &dev->subdevices[1]; - if (devpriv->s_EeParameters.i_NbrAoChannel) { + if (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 = board->i_NbrAoChannel; + s->maxdata = board->i_AoMaxdata; s->range_table = &apci3xxx_ao_range; s->insn_config = board->ao_config; s->insn_write = board->ao_write; @@ -716,12 +701,11 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, } /* Allocate and Initialise DI Subdevice Structures */ s = &dev->subdevices[2]; - if (devpriv->s_EeParameters.i_NbrDiChannel) { + if (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 = board->i_NbrDiChannel; s->maxdata = 1; - s->len_chanlist = devpriv->s_EeParameters.i_NbrDiChannel; s->range_table = &range_digital; s->io_bits = 0; /* all bits input */ s->insn_bits = apci3xxx_di_insn_bits; @@ -730,13 +714,12 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, } /* Allocate and Initialise DO Subdevice Structures */ s = &dev->subdevices[3]; - if (devpriv->s_EeParameters.i_NbrDoChannel) { + if (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->n_chan = board->i_NbrDoChannel; s->maxdata = 1; - s->len_chanlist = devpriv->s_EeParameters.i_NbrDoChannel; s->range_table = &range_digital; s->io_bits = 0xf; /* all bits output */ s->insn_bits = apci3xxx_do_insn_bits; -- 2.20.1