staging: comedi: addi_apci_3120: tidy up apci3120_reset()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 4 Nov 2014 17:55:06 +0000 (10:55 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 17:34:04 +0000 (09:34 -0800)
This function is only called during the attach of the driver and it's
called after the private data has been kzalloc'd. There is no reason
to clear any of the private data members.

Simplify the function by just writing '0' to the necessary registers
to disable all the interrupt sources and stop the timers.

For aesthetics, change the return type to void.

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/addi-data/hwdrv_apci3120.c

index 78d3597..f5948fd 100644 (file)
@@ -72,25 +72,16 @@ static void apci3120_addon_write(struct comedi_device *dev,
        outw((val >> 16) & 0xffff, devpriv->addon + APCI3120_ADDON_DATA_REG);
 }
 
-static int apci3120_reset(struct comedi_device *dev)
+static void apci3120_reset(struct comedi_device *dev)
 {
-       struct apci3120_private *devpriv = dev->private;
-
-       /*  variables used in timer subdevice */
-       devpriv->b_Timer2Mode = 0;
-       devpriv->b_Timer2Interrupt = 0;
-
-       /* Disable all interrupts, watchdog for the anolog output */
-       devpriv->mode = 0;
-       outb(devpriv->mode, dev->iobase + APCI3120_MODE_REG);
+       /* disable all interrupt sources */
+       outb(0, dev->iobase + APCI3120_MODE_REG);
 
        /* disable all counters, ext trigger, and reset scan */
-       devpriv->ctrl = 0;
-       outw(devpriv->ctrl, dev->iobase + APCI3120_CTRL_REG);
+       outw(0, dev->iobase + APCI3120_CTRL_REG);
 
+       /* clear interrupt status */
        inw(dev->iobase + APCI3120_STATUS_REG);
-
-       return 0;
 }
 
 static int apci3120_cancel(struct comedi_device *dev,