From a6a1cfed89b5aca6e5ba179b3788d639ebe0c624 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 4 Nov 2014 10:54:01 -0700 Subject: [PATCH] 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 77704685e108..30606c947530 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -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 */