summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/dyna_pci10xx.c
diff options
context:
space:
mode:
authorH Hartley Sweeten2013-08-30 20:05:58 +0200
committerGreg Kroah-Hartman2013-09-17 16:47:40 +0200
commit97f4289ad08cffe55de06d4ac4f89ac540450aee (patch)
tree9aac1e13dd79ecc23b38d6955f80bdcf68b020df /drivers/staging/comedi/drivers/dyna_pci10xx.c
parentstaging: comedi: usbdux drivers: use comedi_dio_update_state() (diff)
downloadkernel-qcow2-linux-97f4289ad08cffe55de06d4ac4f89ac540450aee.tar.gz
kernel-qcow2-linux-97f4289ad08cffe55de06d4ac4f89ac540450aee.tar.xz
kernel-qcow2-linux-97f4289ad08cffe55de06d4ac4f89ac540450aee.zip
staging: comedi: drivers: use comedi_dio_update_state() for simple cases
Use comedi_dio_update_state() to handle the boilerplate code to update the subdevice s->state for simple cases where the hardware is updated when any channel is modified. Also, fix a bug in the amplc_pc263 and amplc_pci263 drivers where the current state is not returned in data[1]. 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>
Diffstat (limited to 'drivers/staging/comedi/drivers/dyna_pci10xx.c')
-rw-r--r--drivers/staging/comedi/drivers/dyna_pci10xx.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c
index fd525f499f2a..f2a9f1c2f3b6 100644
--- a/drivers/staging/comedi/drivers/dyna_pci10xx.c
+++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c
@@ -147,33 +147,23 @@ static int dyna_pci10xx_di_insn_bits(struct comedi_device *dev,
return insn->n;
}
-/* digital output bit interface */
static int dyna_pci10xx_do_insn_bits(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
struct dyna_pci10xx_private *devpriv = dev->private;
- /* The insn data is a mask in data[0] and the new data
- * in data[1], each channel cooresponding to a bit.
- * s->state contains the previous write data
- */
mutex_lock(&devpriv->mutex);
- if (data[0]) {
- s->state &= ~data[0];
- s->state |= (data[0] & data[1]);
+ if (comedi_dio_update_state(s, data)) {
smp_mb();
outw_p(s->state, devpriv->BADR3);
udelay(10);
}
- /*
- * On return, data[1] contains the value of the digital
- * input and output lines. We just return the software copy of the
- * output values if it was a purely digital output subdevice.
- */
data[1] = s->state;
mutex_unlock(&devpriv->mutex);
+
return insn->n;
}