staging: comedi: usbdux drivers: use comedi_dio_update_state()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 30 Aug 2013 18:05:38 +0000 (11:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Sep 2013 14:47:40 +0000 (07:47 -0700)
Use comedi_dio_update_state() to handle the boilerplate code to update
the subdevice s->state.

These drivers always need to update the hardware in order to update
the i/o configuration regardless of if the state has changed.

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>
drivers/staging/comedi/drivers/usbdux.c
drivers/staging/comedi/drivers/usbduxsigma.c

index 701ad1a6939469d04df237ed71971006d7ed60ee..9218d7336923b199fca893e129b85f84b83e2877 100644 (file)
@@ -1133,15 +1133,13 @@ static int usbdux_dio_insn_bits(struct comedi_device *dev,
 {
 
        struct usbdux_private *devpriv = dev->private;
-       unsigned int mask = data[0];
-       unsigned int bits = data[1];
        int ret;
 
        down(&devpriv->sem);
 
-       s->state &= ~mask;
-       s->state |= (bits & mask);
+       comedi_dio_update_state(s, data);
 
+       /* Always update the hardware. See the (*insn_config). */
        devpriv->dux_commands[1] = s->io_bits;
        devpriv->dux_commands[2] = s->state;
 
index c47f4087568fc0e4fae91c83433c49f9dba6c0eb..5618e61893da917cb48a7cf921ddc616d86d1860 100644 (file)
@@ -1059,15 +1059,13 @@ static int usbduxsigma_dio_insn_bits(struct comedi_device *dev,
                                     unsigned int *data)
 {
        struct usbduxsigma_private *devpriv = dev->private;
-       unsigned int mask = data[0];
-       unsigned int bits = data[1];
        int ret;
 
        down(&devpriv->sem);
 
-       s->state &= ~mask;
-       s->state |= (bits & mask);
+       comedi_dio_update_state(s, data);
 
+       /* Always update the hardware. See the (*insn_config). */
        devpriv->dux_commands[1] = s->io_bits & 0xff;
        devpriv->dux_commands[4] = s->state & 0xff;
        devpriv->dux_commands[2] = (s->io_bits >> 8) & 0xff;