From 4c9213374c9862f9f1060ec4da944514c21bd290 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 30 Aug 2013 11:45:02 -0700 Subject: [PATCH] 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 5565a99c6858..fc73434ba9a4 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -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]; -- 2.30.2