[PATCH 08/13] staging: comedi: adv_pci1724: index subdevices as array

Ian Abbott abbotti at mev.co.uk
Tue Feb 19 13:09:15 UTC 2013


Use array index operator instead of pointer arithmetic in
`alloc_subdevices()`.

Signed-off-by: Ian Abbott <abbotti at mev.co.uk>
Cc: Frank Mori Hess <fmh6jj at gmail.com>
---
 drivers/staging/comedi/drivers/adv_pci1724.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1724.c b/drivers/staging/comedi/drivers/adv_pci1724.c
index 36cc876..ea72936 100644
--- a/drivers/staging/comedi/drivers/adv_pci1724.c
+++ b/drivers/staging/comedi/drivers/adv_pci1724.c
@@ -205,10 +205,9 @@ static int setup_subdevices(struct comedi_device *dev)
 		return ret;
 
 	/* analog output subdevice */
-	s = dev->subdevices + 0;
+	s = &dev->subdevices[0];
 	s->type = COMEDI_SUBD_AO;
-	s->subdev_flags =
-	    SDF_READABLE | SDF_WRITABLE | SDF_GROUND;
+	s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND;
 	s->n_chan = NUM_AO_CHANNELS;
 	s->maxdata = 0x3fff;
 	s->range_table = &ao_ranges_1724;
@@ -216,7 +215,7 @@ static int setup_subdevices(struct comedi_device *dev)
 	s->insn_write = ao_winsn;
 
 	/* offset calibration */
-	s = dev->subdevices + 1;
+	s = &dev->subdevices[1];
 	s->type = COMEDI_SUBD_CALIB;
 	s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL;
 	s->n_chan = NUM_AO_CHANNELS;
@@ -225,7 +224,7 @@ static int setup_subdevices(struct comedi_device *dev)
 	s->maxdata = 0x3fff;
 
 	/* gain calibration */
-	s = dev->subdevices + 2;
+	s = &dev->subdevices[2];
 	s->type = COMEDI_SUBD_CALIB;
 	s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL;
 	s->n_chan = NUM_AO_CHANNELS;
-- 
1.8.1.2




More information about the devel mailing list