[PATCH 3/6] staging: comedi: pcl730: tidy up pcl730_di_insn()

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

 



For aesthetic reasons, rename the function.

Use a local variable for the 'reg' offset that is stored in the
comedi_subdevice 'private' pointer to minimize the number of casts.

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

diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c
index ab51c92..bde2e30 100644
--- a/drivers/staging/comedi/drivers/pcl730.c
+++ b/drivers/staging/comedi/drivers/pcl730.c
@@ -66,11 +66,14 @@ static int pcl730_do_insn_bits(struct comedi_device *dev,
 	return insn->n;
 }
 
-static int pcl730_di_insn(struct comedi_device *dev, struct comedi_subdevice *s,
-			  struct comedi_insn *insn, unsigned int *data)
+static int pcl730_di_insn_bits(struct comedi_device *dev,
+			       struct comedi_subdevice *s,
+			       struct comedi_insn *insn,
+			       unsigned int *data)
 {
-	data[1] = inb(dev->iobase + ((unsigned long)s->private)) |
-	    (inb(dev->iobase + ((unsigned long)s->private) + 1) << 8);
+	unsigned long reg = (unsigned long)s->private;
+
+	data[1] = inb(dev->iobase + reg) | (inb(dev->iobase + reg + 1) << 8);
 
 	return insn->n;
 }
@@ -105,7 +108,7 @@ static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	s->subdev_flags = SDF_READABLE;
 	s->maxdata = 1;
 	s->n_chan = 16;
-	s->insn_bits = pcl730_di_insn;
+	s->insn_bits = pcl730_di_insn_bits;
 	s->range_table = &range_digital;
 	s->private = (void *)PCL730_IDIO_LO;
 
@@ -125,7 +128,7 @@ static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	s->subdev_flags = SDF_READABLE;
 	s->maxdata = 1;
 	s->n_chan = 16;
-	s->insn_bits = pcl730_di_insn;
+	s->insn_bits = pcl730_di_insn_bits;
 	s->range_table = &range_digital;
 	s->private = (void *)PCL730_DIO_LO;
 
-- 
1.8.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/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