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

staging: comedi: adl_pci9118: cleanup and simplify pci9118_reset()

Change the return type to void, this function always succeeds and the
callers never check the return value.

According to the The User Manual for the PCI-9118, the hardware does not
require any particular "reset" in order to function. Simplify the reset
so it justs gets the board info a known state with interrupts disabled.

There is no reason to initialize the private data members in this function.
They all default to '0' due to the kzalloc() of the private data and the
subdevice operations all initialize them as needed.
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 3cb3fc0a
......@@ -1654,63 +1654,30 @@ static int pci9118_do_insn_bits(struct comedi_device *dev,
return insn->n;
}
static int pci9118_reset(struct comedi_device *dev)
static void pci9118_reset(struct comedi_device *dev)
{
struct pci9118_private *devpriv = dev->private;
/* reset analog input subsystem */
outl(0, dev->iobase + PCI9118_INT_CTRL_REG);
outl(0, dev->iobase + PCI9118_AI_CTRL_REG);
outl(0, dev->iobase + PCI9118_AI_CFG_REG);
pci9118_ai_reset_fifo(dev);
devpriv->IntControlReg = 0;
devpriv->exttrg_users = 0;
/* clear interrupts then disable all interrupt sources */
/* clear any pending interrupts and status */
inl(dev->iobase + PCI9118_INT_CTRL_REG);
outl(devpriv->IntControlReg, dev->iobase + PCI9118_INT_CTRL_REG);
inl(dev->iobase + PCI9118_AI_STATUS_REG);
/* reset and stop counters */
pci9118_timer_set_mode(dev, 0, I8254_MODE0);
pci9118_start_pacer(dev, 0); /* stop 8254 counters */
devpriv->AdControlReg = 0;
outl(devpriv->AdControlReg, dev->iobase + PCI9118_AI_CTRL_REG);
/*
* bipolar, S.E., use 8254,
* stop 8354, internal trigger,
* soft trigger,
* disable INT and DMA
*/
pci9118_start_pacer(dev, 0);
/* reset DMA and scan queue */
outl(0, dev->iobase + PCI9118_AI_BURST_NUM_REG);
/* reset scan queue */
outl(1, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG);
outl(2, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG);
devpriv->AdFunctionReg = PCI9118_AI_CFG_PDTRG | PCI9118_AI_CFG_PETRG;
outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG);
/*
* positive triggers, no S&H,
* no burst, burst stop,
* no post trigger,
* no about trigger,
* trigger stop
*/
/* reset analog outputs to 0V */
outl(2047, dev->iobase + PCI9118_AO_REG(0));
outl(2047, dev->iobase + PCI9118_AO_REG(1));
udelay(10);
inl(dev->iobase + PCI9118_AI_FIFO_REG);
pci9118_ai_reset_fifo(dev);
/* disable all interrupt sources */
outl(0, dev->iobase + PCI9118_INT_CTRL_REG);
/* clear A/D and INT status registers */
inl(dev->iobase + PCI9118_AI_STATUS_REG);
inl(dev->iobase + PCI9118_INT_CTRL_REG);
devpriv->AdControlReg = 0;
outl(devpriv->AdControlReg, dev->iobase + PCI9118_AI_CTRL_REG);
/*
* bipolar, S.E., use 8254,
* stop 8354, internal trigger,
* soft trigger,
* disable INT and DMA
*/
devpriv->exttrg_users = 0;
return 0;
}
static struct pci_dev *pci9118_find_pci(struct comedi_device *dev,
......
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