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

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

 



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

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Frank Mori Hess <fmh6jj@xxxxxxxxx>
---
 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

_______________________________________________
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