[PATCH 04/15] staging: comedi: comedi_parport: fix parport_insn_config_a()

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

 



This is the (*insn_config) function for a DIO subdevice. It should be
using the data[0] value as the "instruction" to perform on the subdevice.

Use the comedi_dio_insn_config() helper to properly handle instructions.

Also, rename the function to better describe it's use.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/comedi_parport.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c
index 6880b69..a0dbb32 100644
--- a/drivers/staging/comedi/drivers/comedi_parport.c
+++ b/drivers/staging/comedi/drivers/comedi_parport.c
@@ -109,22 +109,25 @@ static int parport_data_reg_insn_bits(struct comedi_device *dev,
 	return insn->n;
 }
 
-static int parport_insn_config_a(struct comedi_device *dev,
-				 struct comedi_subdevice *s,
-				 struct comedi_insn *insn, unsigned int *data)
+static int parport_data_reg_insn_config(struct comedi_device *dev,
+					struct comedi_subdevice *s,
+					struct comedi_insn *insn,
+					unsigned int *data)
 {
 	struct parport_private *devpriv = dev->private;
+	int ret;
 
-	if (data[0]) {
-		s->io_bits = 0xff;
+	ret = comedi_dio_insn_config(dev, s, insn, data, 0xff);
+	if (ret)
+		return ret;
+
+	if (s->io_bits)
 		devpriv->c_data &= ~PARPORT_CTRL_BIDIR_ENA;
-	} else {
-		s->io_bits = 0;
+	else
 		devpriv->c_data |= PARPORT_CTRL_BIDIR_ENA;
-	}
 	outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG);
 
-	return 1;
+	return insn->n;
 }
 
 static int parport_insn_b(struct comedi_device *dev, struct comedi_subdevice *s,
@@ -288,7 +291,7 @@ static int parport_attach(struct comedi_device *dev,
 	s->maxdata = 1;
 	s->range_table = &range_digital;
 	s->insn_bits = parport_data_reg_insn_bits;
-	s->insn_config = parport_insn_config_a;
+	s->insn_config = parport_data_reg_insn_config;
 
 	s = &dev->subdevices[1];
 	s->type = COMEDI_SUBD_DI;
-- 
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