staging: comedi: adl_pci9118: cleanup and simplify pci9118_reset()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 5 Sep 2014 16:25:40 +0000 (09:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Sep 2014 20:56:07 +0000 (13:56 -0700)
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 <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/adl_pci9118.c

index 4a956ccb1accc448a8e52e2be1489dfcfc7816cd..56458acdac7595169844e6a796886d62b4a523de 100644 (file)
@@ -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,