Browse Source

staging: comedi: addi_apci_3120: tidy up apci3120_reset()

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>
H Hartley Sweeten 11 years ago
parent
commit
884218c5a3
1 changed files with 5 additions and 14 deletions
  1. 5 14
      drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c

+ 5 - 14
drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c

@@ -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,