[PATCH 16/22] staging: comedi: adv_pci1710: post increment 'subdev' in (*auto_attach)

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

 



For aesthetics, post-increment the 'subdev' index when used to get a
comedi_subdevice pointer instead of incrementing it after the subdevice
is initialized.

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c
index 0511f26..1819bcf 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -786,7 +786,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
 
 	subdev = 0;
 
-	s = &dev->subdevices[subdev];
+	s = &dev->subdevices[subdev++];
 	s->type		= COMEDI_SUBD_AI;
 	s->subdev_flags	= SDF_READABLE | SDF_COMMON | SDF_GROUND;
 	if (!board->is_pci1711)
@@ -812,10 +812,8 @@ static int pci1710_auto_attach(struct comedi_device *dev,
 		}
 	}
 
-	subdev++;
-
 	if (board->has_ao) {
-		s = &dev->subdevices[subdev];
+		s = &dev->subdevices[subdev++];
 		s->type		= COMEDI_SUBD_AO;
 		s->subdev_flags	= SDF_WRITABLE;
 		s->n_chan	= 2;
@@ -826,32 +824,28 @@ static int pci1710_auto_attach(struct comedi_device *dev,
 		ret = comedi_alloc_subdev_readback(s);
 		if (ret)
 			return ret;
-
-		subdev++;
 	}
 
 	if (!board->is_pci1713) {
-		s = &dev->subdevices[subdev];
+		s = &dev->subdevices[subdev++];
 		s->type		= COMEDI_SUBD_DI;
 		s->subdev_flags	= SDF_READABLE;
 		s->n_chan	= 16;
 		s->maxdata	= 1;
 		s->range_table	= &range_digital;
 		s->insn_bits	= pci1710_di_insn_bits;
-		subdev++;
 
-		s = &dev->subdevices[subdev];
+		s = &dev->subdevices[subdev++];
 		s->type		= COMEDI_SUBD_DO;
 		s->subdev_flags	= SDF_WRITABLE;
 		s->n_chan	= 16;
 		s->maxdata	= 1;
 		s->range_table	= &range_digital;
 		s->insn_bits	= pci1710_do_insn_bits;
-		subdev++;
 	}
 
 	/* Counter subdevice (8254) */
-	s = &dev->subdevices[subdev];
+	s = &dev->subdevices[subdev++];
 	comedi_8254_subdevice_init(s, dev->pacer);
 
 	dev->pacer->insn_config = pci1710_counter_insn_config;
@@ -860,8 +854,6 @@ static int pci1710_auto_attach(struct comedi_device *dev,
 	comedi_8254_set_busy(dev->pacer, 1, true);
 	comedi_8254_set_busy(dev->pacer, 2, true);
 
-	subdev++;
-
 	/* max_samples is half the FIFO size (2 bytes/sample) */
 	devpriv->max_samples = (board->is_pci1711) ? 512 : 2048;
 
-- 
2.5.1

_______________________________________________
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