staging: comedi: das08: remove do_bits from private data
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 30 Aug 2013 18:07:17 +0000 (11:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Sep 2013 14:47:41 +0000 (07:47 -0700)
Use the subdevice 'state' variable instead of carrying the state of
the output channels in the private data.

Use comedi_dio_update_state() to handle the boilerplate code to update
the subdevice s->state.

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/das08.c
drivers/staging/comedi/drivers/das08.h

index 5f669709501f90376afe046e84bda819f1544f2d..1add6fb883f5a1a06c033702ef0b4902af6d3f18 100644 (file)
@@ -316,17 +316,13 @@ static int das08jr_di_rbits(struct comedi_device *dev,
 
 static int das08jr_do_wbits(struct comedi_device *dev,
                            struct comedi_subdevice *s,
-                           struct comedi_insn *insn, unsigned int *data)
+                           struct comedi_insn *insn,
+                           unsigned int *data)
 {
-       struct das08_private_struct *devpriv = dev->private;
-
-       /*  null bits we are going to set */
-       devpriv->do_bits &= ~data[0];
-       /*  set new bit values */
-       devpriv->do_bits |= data[0] & data[1];
-       outb(devpriv->do_bits, dev->iobase + DAS08JR_DIO);
+       if (comedi_dio_update_state(s, data))
+               outb(s->state, dev->iobase + DAS08JR_DIO);
 
-       data[1] = devpriv->do_bits;
+       data[1] = s->state;
 
        return insn->n;
 }
index cce1b584200a82acbf1036af85fa91c103b2d3e8..46a314c5113e56c5699ae242b66db2e4b19c79a0 100644 (file)
@@ -41,7 +41,6 @@ struct das08_board_struct {
 
 struct das08_private_struct {
        unsigned int do_mux_bits;       /*  bits for do/mux register on boards without separate do register */
-       unsigned int do_bits;   /*  bits for do register on boards with register dedicated to digital out only */
        const unsigned int *pg_gainlist;
        unsigned int ao_readback[2];    /* assume 2 AO channels */
 };