[PATCH v2 03/15] staging: comedi: comedi_parport: tidy up parport_insn_a()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
Reviewed-by: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 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 5565a99..fc73434 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];
-- 
1.8.3.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux