summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers/multiq3.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hartleys@visionengravers.com>2012-09-05 18:46:47 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-05 20:06:28 -0700
commit1b348f0594ec31b974cd8082dd5f1e4b5f3aa2db (patch)
treecf030ff8e62583c80bd5f43c8b68dc499c7586fa /drivers/staging/comedi/drivers/multiq3.c
parente49b26e779cce2a5e73b7433d9edcbd157f5a470 (diff)
staging: comedi: multiq3: remove subdevice pointer math
Convert the comedi_subdevice access from pointer math to array access. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/multiq3.c')
-rw-r--r--drivers/staging/comedi/drivers/multiq3.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/staging/comedi/drivers/multiq3.c b/drivers/staging/comedi/drivers/multiq3.c
index eccbe1fb4f2c..4625cb4d07c6 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -204,8 +204,10 @@ static int multiq3_encoder_insn_read(struct comedi_device *dev,
static void encoder_reset(struct comedi_device *dev)
{
+ struct comedi_subdevice *s = &dev->subdevices[4];
int chan;
- for (chan = 0; chan < dev->subdevices[4].n_chan; chan++) {
+
+ for (chan = 0; chan < s->n_chan; chan++) {
int control =
MULTIQ3_CONTROL_MUST | MULTIQ3_AD_MUX_EN | (chan << 3);
outw(control, dev->iobase + MULTIQ3_CONTROL);
@@ -258,7 +260,7 @@ static int multiq3_attach(struct comedi_device *dev,
if (result < 0)
return result;
- s = dev->subdevices + 0;
+ s = &dev->subdevices[0];
/* ai subdevice */
s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_GROUND;
@@ -267,7 +269,7 @@ static int multiq3_attach(struct comedi_device *dev,
s->maxdata = 0x1fff;
s->range_table = &range_bipolar5;
- s = dev->subdevices + 1;
+ s = &dev->subdevices[1];
/* ao subdevice */
s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE;
@@ -277,7 +279,7 @@ static int multiq3_attach(struct comedi_device *dev,
s->maxdata = 0xfff;
s->range_table = &range_bipolar5;
- s = dev->subdevices + 2;
+ s = &dev->subdevices[2];
/* di subdevice */
s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE;
@@ -286,7 +288,7 @@ static int multiq3_attach(struct comedi_device *dev,
s->maxdata = 1;
s->range_table = &range_digital;
- s = dev->subdevices + 3;
+ s = &dev->subdevices[3];
/* do subdevice */
s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITABLE;
@@ -296,7 +298,7 @@ static int multiq3_attach(struct comedi_device *dev,
s->range_table = &range_digital;
s->state = 0;
- s = dev->subdevices + 4;
+ s = &dev->subdevices[4];
/* encoder (counter) subdevice */
s->type = COMEDI_SUBD_COUNTER;
s->subdev_flags = SDF_READABLE | SDF_LSAMPL;