staging: comedi: addi_apci_3120: tidy up apci3120_exttrig_{enable,disable}()

Merge these two functions and use an 'enable' parameter to determine if the
external trigger needs to be enabled or disabled.

This function always succeeds and the callers don't check the return. 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>
This commit is contained in:
H Hartley Sweeten 2014-11-04 10:54:01 -07:00 committed by Greg Kroah-Hartman
parent 6d210c8d96
commit a6a1cfed89
1 changed files with 8 additions and 15 deletions

View File

@ -477,22 +477,15 @@ static int apci3120_reset(struct comedi_device *dev)
return 0;
}
static int apci3120_exttrig_enable(struct comedi_device *dev)
static void apci3120_exttrig_enable(struct comedi_device *dev, bool enable)
{
struct apci3120_private *devpriv = dev->private;
devpriv->ctrl |= APCI3120_CTRL_EXT_TRIG;
if (enable)
devpriv->ctrl |= APCI3120_CTRL_EXT_TRIG;
else
devpriv->ctrl &= ~APCI3120_CTRL_EXT_TRIG;
outw(devpriv->ctrl, dev->iobase + APCI3120_WR_ADDRESS);
return 0;
}
static int apci3120_exttrig_disable(struct comedi_device *dev)
{
struct apci3120_private *devpriv = dev->private;
devpriv->ctrl &= ~APCI3120_CTRL_EXT_TRIG;
outw(devpriv->ctrl, dev->iobase + APCI3120_WR_ADDRESS);
return 0;
}
static int apci3120_cancel(struct comedi_device *dev,
@ -649,7 +642,8 @@ static int apci3120_cyclic_ai(int mode,
}
if (devpriv->b_ExttrigEnable == APCI3120_ENABLE)
apci3120_exttrig_enable(dev); /* activate EXT trigger */
apci3120_exttrig_enable(dev, true);
switch (mode) {
case 1:
/* init timer0 in mode 2 */
@ -1114,8 +1108,7 @@ static irqreturn_t apci3120_interrupt(int irq, void *d)
int_daq = (int_daq >> 12) & 0xF;
if (devpriv->b_ExttrigEnable == APCI3120_ENABLE) {
/* Disable ext trigger */
apci3120_exttrig_disable(dev);
apci3120_exttrig_enable(dev, false);
devpriv->b_ExttrigEnable = APCI3120_DISABLE;
}
/* clear the timer 2 interrupt */