Re: [PATCH 06/15] staging: comedi: comedi_parport: tidy up parport_insn_c()

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

 



On 2013-08-28 21:57, H Hartley Sweeten wrote:
Rename this function to better describe it's use.

Use comedi_dio_insn_bits() to handle the boilerplate code to update
the subdevice s->state.

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 | 18 +++++++++---------
  1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c
index 04feec7..7180b0c 100644
--- a/drivers/staging/comedi/drivers/comedi_parport.c
+++ b/drivers/staging/comedi/drivers/comedi_parport.c
@@ -140,20 +140,20 @@ static int parport_status_reg_insn_bits(struct comedi_device *dev,
  	return insn->n;
  }

-static int parport_insn_c(struct comedi_device *dev, struct comedi_subdevice *s,
-			  struct comedi_insn *insn, unsigned int *data)
+static int parport_ctrl_reg_insn_bits(struct comedi_device *dev,
+				      struct comedi_subdevice *s,
+				      struct comedi_insn *insn,
+				      unsigned int *data)
  {
  	struct parport_private *devpriv = dev->private;

-	data[0] &= 0x0f;
-	if (data[0]) {
-		devpriv->c_data &= ~data[0];
-		devpriv->c_data |= (data[0] & data[1]);
-
+	if (comedi_dio_insn_bits(dev, s, insn, data)) {
+		devpriv->c_data &= ~((1 << s->n_chan) - 1);
+		devpriv->c_data |= s->state;
  		outb(devpriv->c_data, dev->iobase + PARPORT_CTRL_REG);
  	}

-	data[1] = devpriv->c_data & 0xf;
+	data[1] = s->state;

  	return insn->n;
  }
@@ -304,7 +304,7 @@ static int parport_attach(struct comedi_device *dev,
  	s->n_chan = 4;
  	s->maxdata = 1;
  	s->range_table = &range_digital;
-	s->insn_bits = parport_insn_c;
+	s->insn_bits = parport_ctrl_reg_insn_bits;

  	s = &dev->subdevices[3];
  	if (irq) {


I'll just note that this patch depends on PATCH 06/11 of your comedi_dio_insn_bits patch series.

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
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