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

staging: comedi: addi_apci_3xxx: absorb apci3xxx_reset()

All the boards supported by this driver use the same 'reset' callback
in the boardinfo. Absorb the reset function, apci3xxx_reset(), from
hwdrv_apci3xxx.c directly into the driver.

Remove i_ADDI_Reset(), which indirectly called the reset function, and
just call apci3xx_reset() directly. Remove the 'reset' callback from
the boardinfo.
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 98d3385d
......@@ -1305,35 +1305,3 @@ static int apci3xxx_do_insn_bits(struct comedi_device *dev,
return insn->n;
}
static int apci3xxx_reset(struct comedi_device *dev)
{
struct addi_private *devpriv = dev->private;
unsigned int val;
int i;
/* Disable the interrupt */
disable_irq(dev->irq);
/* Reset the interrupt flag */
devpriv->b_EocEosInterrupt = 0;
/* Clear the start command */
writel(0, devpriv->dw_AiBase + 8);
/* Reset the interrupt flags */
val = readl(devpriv->dw_AiBase + 16);
writel(val, devpriv->dw_AiBase + 16);
/* clear the EOS */
readl(devpriv->dw_AiBase + 20);
/* Clear the FIFO */
for (i = 0; i < 16; i++)
val = readl(devpriv->dw_AiBase + 28);
/* Enable the interrupt */
enable_irq(dev->irq);
return 0;
}
......@@ -56,7 +56,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
......@@ -78,7 +77,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
......@@ -100,7 +98,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
......@@ -122,7 +119,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
......@@ -144,7 +140,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
......@@ -166,7 +161,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
......@@ -191,7 +185,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.di_bits = apci3xxx_di_insn_bits,
......@@ -218,7 +211,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.di_bits = apci3xxx_di_insn_bits,
......@@ -245,7 +237,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.di_bits = apci3xxx_di_insn_bits,
......@@ -272,7 +263,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.di_bits = apci3xxx_di_insn_bits,
......@@ -299,7 +289,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.di_bits = apci3xxx_di_insn_bits,
......@@ -326,7 +315,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.di_bits = apci3xxx_di_insn_bits,
......@@ -353,7 +341,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
......@@ -379,7 +366,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
......@@ -405,7 +391,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
......@@ -431,7 +416,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
......@@ -460,7 +444,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
......@@ -491,7 +474,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
......@@ -522,7 +504,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
......@@ -553,7 +534,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
......@@ -579,7 +559,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 7,
.ui_MinAcquisitiontimeNs = 2500,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.di_bits = apci3xxx_di_insn_bits,
......@@ -600,7 +579,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.di_bits = apci3xxx_di_insn_bits,
......@@ -621,7 +599,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.di_bits = apci3xxx_di_insn_bits,
......@@ -642,7 +619,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.di_bits = apci3xxx_di_insn_bits,
......@@ -658,7 +634,6 @@ static const struct addi_board apci3xxx_boardtypes[] = {
.pr_AoRangelist = &range_apci3XXX_ao,
.i_NbrTTLChannel = 24,
.interrupt = v_APCI3XXX_Interrupt,
.reset = apci3xxx_reset,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.ttl_bits = i_APCI3XXX_InsnBitsTTLIO,
......@@ -693,11 +668,35 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d)
return IRQ_RETVAL(1);
}
static int i_ADDI_Reset(struct comedi_device *dev)
static int apci3xxx_reset(struct comedi_device *dev)
{
const struct addi_board *this_board = comedi_board(dev);
struct addi_private *devpriv = dev->private;
unsigned int val;
int i;
/* Disable the interrupt */
disable_irq(dev->irq);
/* Reset the interrupt flag */
devpriv->b_EocEosInterrupt = 0;
/* Clear the start command */
writel(0, devpriv->dw_AiBase + 8);
/* Reset the interrupt flags */
val = readl(devpriv->dw_AiBase + 16);
writel(val, devpriv->dw_AiBase + 16);
/* clear the EOS */
readl(devpriv->dw_AiBase + 20);
/* Clear the FIFO */
for (i = 0; i < 16; i++)
val = readl(devpriv->dw_AiBase + 28);
/* Enable the interrupt */
enable_irq(dev->irq);
this_board->reset(dev);
return 0;
}
......@@ -926,7 +925,7 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED;
}
i_ADDI_Reset(dev);
apci3xxx_reset(dev);
return 0;
}
......@@ -936,7 +935,7 @@ static void apci3xxx_detach(struct comedi_device *dev)
if (devpriv) {
if (dev->iobase)
i_ADDI_Reset(dev);
apci3xxx_reset(dev);
if (dev->irq)
free_irq(dev->irq, dev);
if (devpriv->dw_AiBase)
......
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