staging: comedi: comedi_parport: tidy up parport_insn_a()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 30 Aug 2013 18:45:02 +0000 (11:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Sep 2013 14:47:42 +0000 (07:47 -0700)
Rename this function to better describe it's use.

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/comedi_parport.c

index 5565a99c6858bcd30f8c1a2b3dd187c9f01d51e1..fc73434ba9a434b26beed13d00a16798087a88a2 100644 (file)
@@ -96,15 +96,13 @@ struct parport_private {
        int enable_irq;
 };
 
-static int parport_insn_a(struct comedi_device *dev, struct comedi_subdevice *s,
-                         struct comedi_insn *insn, unsigned int *data)
+static int parport_data_reg_insn_bits(struct comedi_device *dev,
+                                     struct comedi_subdevice *s,
+                                     struct comedi_insn *insn,
+                                     unsigned int *data)
 {
-       if (data[0]) {
-               s->state &= ~data[0];
-               s->state |= (data[0] & data[1]);
-
+       if (comedi_dio_update_state(s, data))
                outb(s->state, dev->iobase + PARPORT_DATA_REG);
-       }
 
        data[1] = inb(dev->iobase + PARPORT_DATA_REG);
 
@@ -289,7 +287,7 @@ static int parport_attach(struct comedi_device *dev,
        s->n_chan = 8;
        s->maxdata = 1;
        s->range_table = &range_digital;
-       s->insn_bits = parport_insn_a;
+       s->insn_bits = parport_data_reg_insn_bits;
        s->insn_config = parport_insn_config_a;
 
        s = &dev->subdevices[1];