Commit 1b348f05 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: multiq3: remove subdevice pointer math

Convert the comedi_subdevice access from pointer math to array
access.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e49b26e7
...@@ -204,8 +204,10 @@ static int multiq3_encoder_insn_read(struct comedi_device *dev, ...@@ -204,8 +204,10 @@ static int multiq3_encoder_insn_read(struct comedi_device *dev,
static void encoder_reset(struct comedi_device *dev) static void encoder_reset(struct comedi_device *dev)
{ {
struct comedi_subdevice *s = &dev->subdevices[4];
int chan; int chan;
for (chan = 0; chan < dev->subdevices[4].n_chan; chan++) {
for (chan = 0; chan < s->n_chan; chan++) {
int control = int control =
MULTIQ3_CONTROL_MUST | MULTIQ3_AD_MUX_EN | (chan << 3); MULTIQ3_CONTROL_MUST | MULTIQ3_AD_MUX_EN | (chan << 3);
outw(control, dev->iobase + MULTIQ3_CONTROL); outw(control, dev->iobase + MULTIQ3_CONTROL);
...@@ -258,7 +260,7 @@ static int multiq3_attach(struct comedi_device *dev, ...@@ -258,7 +260,7 @@ static int multiq3_attach(struct comedi_device *dev,
if (result < 0) if (result < 0)
return result; return result;
s = dev->subdevices + 0; s = &dev->subdevices[0];
/* ai subdevice */ /* ai subdevice */
s->type = COMEDI_SUBD_AI; s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_GROUND; s->subdev_flags = SDF_READABLE | SDF_GROUND;
...@@ -267,7 +269,7 @@ static int multiq3_attach(struct comedi_device *dev, ...@@ -267,7 +269,7 @@ static int multiq3_attach(struct comedi_device *dev,
s->maxdata = 0x1fff; s->maxdata = 0x1fff;
s->range_table = &range_bipolar5; s->range_table = &range_bipolar5;
s = dev->subdevices + 1; s = &dev->subdevices[1];
/* ao subdevice */ /* ao subdevice */
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE; s->subdev_flags = SDF_WRITABLE;
...@@ -277,7 +279,7 @@ static int multiq3_attach(struct comedi_device *dev, ...@@ -277,7 +279,7 @@ static int multiq3_attach(struct comedi_device *dev,
s->maxdata = 0xfff; s->maxdata = 0xfff;
s->range_table = &range_bipolar5; s->range_table = &range_bipolar5;
s = dev->subdevices + 2; s = &dev->subdevices[2];
/* di subdevice */ /* di subdevice */
s->type = COMEDI_SUBD_DI; s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE; s->subdev_flags = SDF_READABLE;
...@@ -286,7 +288,7 @@ static int multiq3_attach(struct comedi_device *dev, ...@@ -286,7 +288,7 @@ static int multiq3_attach(struct comedi_device *dev,
s->maxdata = 1; s->maxdata = 1;
s->range_table = &range_digital; s->range_table = &range_digital;
s = dev->subdevices + 3; s = &dev->subdevices[3];
/* do subdevice */ /* do subdevice */
s->type = COMEDI_SUBD_DO; s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITABLE; s->subdev_flags = SDF_WRITABLE;
...@@ -296,7 +298,7 @@ static int multiq3_attach(struct comedi_device *dev, ...@@ -296,7 +298,7 @@ static int multiq3_attach(struct comedi_device *dev,
s->range_table = &range_digital; s->range_table = &range_digital;
s->state = 0; s->state = 0;
s = dev->subdevices + 4; s = &dev->subdevices[4];
/* encoder (counter) subdevice */ /* encoder (counter) subdevice */
s->type = COMEDI_SUBD_COUNTER; s->type = COMEDI_SUBD_COUNTER;
s->subdev_flags = SDF_READABLE | SDF_LSAMPL; s->subdev_flags = SDF_READABLE | SDF_LSAMPL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment