staging: comedi: comedi_parport: tidy up parport_insn_a()

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>
This commit is contained in:
H Hartley Sweeten 2013-08-30 11:45:02 -07:00 committed by Greg Kroah-Hartman
parent 9f1a0909de
commit 4c9213374c

View 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];