From 5358e8996f76ba5f44992226f7eb15d502c663fa Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 5 Sep 2014 09:25:40 -0700 Subject: [PATCH] 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: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 59 +++++--------------- 1 file changed, 13 insertions(+), 46 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 4a956ccb1acc..56458acdac75 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -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, -- 2.34.1