[PATCH 21/26] staging: comedi: ni_labpc: tidy up calib and memory subdevice init

H Hartley Sweeten hsweeten at visionengravers.com
Wed Mar 20 01:09:24 UTC 2013


For aesthetic reasons, rename the (*insn_read) and (*insn_write)
functions to help with greps.

Add some whitespace to the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/staging/comedi/drivers/ni_labpc.c | 48 +++++++++++++++++--------------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index 926ebc6..87dfd36 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -1506,9 +1506,10 @@ static void write_caldac(struct comedi_device *dev, unsigned int channel,
 	devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
 }
 
-static int labpc_calib_write_insn(struct comedi_device *dev,
+static int labpc_calib_insn_write(struct comedi_device *dev,
 				  struct comedi_subdevice *s,
-				  struct comedi_insn *insn, unsigned int *data)
+				  struct comedi_insn *insn,
+				  unsigned int *data)
 {
 	int channel = CR_CHAN(insn->chanspec);
 
@@ -1516,9 +1517,10 @@ static int labpc_calib_write_insn(struct comedi_device *dev,
 	return 1;
 }
 
-static int labpc_calib_read_insn(struct comedi_device *dev,
+static int labpc_calib_insn_read(struct comedi_device *dev,
 				 struct comedi_subdevice *s,
-				 struct comedi_insn *insn, unsigned int *data)
+				 struct comedi_insn *insn,
+				 unsigned int *data)
 {
 	struct labpc_private *devpriv = dev->private;
 
@@ -1527,9 +1529,10 @@ static int labpc_calib_read_insn(struct comedi_device *dev,
 	return 1;
 }
 
-static int labpc_eeprom_write_insn(struct comedi_device *dev,
+static int labpc_eeprom_insn_write(struct comedi_device *dev,
 				   struct comedi_subdevice *s,
-				   struct comedi_insn *insn, unsigned int *data)
+				   struct comedi_insn *insn,
+				   unsigned int *data)
 {
 	int channel = CR_CHAN(insn->chanspec);
 	int ret;
@@ -1548,9 +1551,10 @@ static int labpc_eeprom_write_insn(struct comedi_device *dev,
 	return 1;
 }
 
-static int labpc_eeprom_read_insn(struct comedi_device *dev,
+static int labpc_eeprom_insn_read(struct comedi_device *dev,
 				  struct comedi_subdevice *s,
-				  struct comedi_insn *insn, unsigned int *data)
+				  struct comedi_insn *insn,
+				  unsigned int *data)
 {
 	struct labpc_private *devpriv = dev->private;
 
@@ -1660,26 +1664,26 @@ int labpc_common_attach(struct comedi_device *dev,
 	if (thisboard->register_layout == labpc_1200_layout) {
 		/* calibration subdevice */
 		s = &dev->subdevices[subdev++];
-		s->type = COMEDI_SUBD_CALIB;
-		s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL;
-		s->n_chan = 16;
-		s->maxdata = 0xff;
-		s->insn_read = labpc_calib_read_insn;
-		s->insn_write = labpc_calib_write_insn;
+		s->type		= COMEDI_SUBD_CALIB;
+		s->subdev_flags	= SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL;
+		s->n_chan	= 16;
+		s->maxdata	= 0xff;
+		s->insn_read	= labpc_calib_insn_read;
+		s->insn_write	= labpc_calib_insn_write;
 
 		for (i = 0; i < s->n_chan; i++)
 			write_caldac(dev, i, s->maxdata / 2);
 
 		/* EEPROM */
 		s = &dev->subdevices[subdev++];
-		s->type = COMEDI_SUBD_MEMORY;
-		s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL;
-		s->n_chan = EEPROM_SIZE;
-		s->maxdata = 0xff;
-		s->insn_read = labpc_eeprom_read_insn;
-		s->insn_write = labpc_eeprom_write_insn;
-
-		for (i = 0; i < EEPROM_SIZE; i++)
+		s->type		= COMEDI_SUBD_MEMORY;
+		s->subdev_flags	= SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL;
+		s->n_chan	= EEPROM_SIZE;
+		s->maxdata	= 0xff;
+		s->insn_read	= labpc_eeprom_insn_read;
+		s->insn_write	= labpc_eeprom_insn_write;
+
+		for (i = 0; i < s->n_chan; i++)
 			devpriv->eeprom_data[i] = labpc_eeprom_read(dev, i);
 	}
 
-- 
1.8.1.4




More information about the devel mailing list