Commit f7f909e0 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: hwdrv_apci3501: refactor apci3501_read_insn_timer()

The handling of the ADDIDATA_WATCHDOG and ADDIDATA_TIMER is identical.
Refactor this function to use a common code path for both timer modes.

Remove the incorrect dev_err() noise. The subdevice is valid but the
timer_mode is not supported.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 626bb280
......@@ -133,19 +133,12 @@ static int apci3501_read_insn_timer(struct comedi_device *dev,
{
struct apci3501_private *devpriv = dev->private;
if (devpriv->timer_mode == ADDIDATA_WATCHDOG) {
data[0] = inl(dev->iobase + APCI3501_TIMER_STATUS_REG) & 0x1;
data[1] = inl(dev->iobase + APCI3501_TIMER_SYNC_REG);
}
if (devpriv->timer_mode != ADDIDATA_TIMER &&
devpriv->timer_mode != ADDIDATA_WATCHDOG)
return -EINVAL;
else if (devpriv->timer_mode == ADDIDATA_TIMER) {
data[0] = inl(dev->iobase + APCI3501_TIMER_STATUS_REG) & 0x1;
data[1] = inl(dev->iobase + APCI3501_TIMER_SYNC_REG);
}
data[0] = inl(dev->iobase + APCI3501_TIMER_STATUS_REG) & 0x1;
data[1] = inl(dev->iobase + APCI3501_TIMER_SYNC_REG);
else if (devpriv->timer_mode != ADDIDATA_TIMER &&
devpriv->timer_mode != ADDIDATA_WATCHDOG) {
dev_err(dev->class_dev, "Invalid subdevice.\n");
}
return insn->n;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment