diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-09-05 18:59:26 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-05 20:06:32 -0700 |
commit | 5818e7090bb6eacb886bd2f7fc3df06e23047b29 (patch) | |
tree | 288470041507ba1dbd376a8b4c9afde12e22a880 /drivers | |
parent | d3d1e2532f33b49515bf9ea9e2b4cc1dbb1d47c9 (diff) | |
download | op-kernel-dev-5818e7090bb6eacb886bd2f7fc3df06e23047b29.zip op-kernel-dev-5818e7090bb6eacb886bd2f7fc3df06e23047b29.tar.gz |
staging: comedi: kcomedilib: 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')
-rw-r--r-- | drivers/staging/comedi/kcomedilib/kcomedilib_main.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c index 0252b44..f96416d 100644 --- a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c +++ b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c @@ -90,7 +90,7 @@ static int comedi_do_insn(struct comedi_device *dev, struct comedi_insn *insn) ret = -EINVAL; goto error; } - s = dev->subdevices + insn->subdev; + s = &dev->subdevices[insn->subdev]; if (s->type == COMEDI_SUBD_UNUSED) { printk(KERN_ERR "%d not useable subdevice\n", insn->subdev); @@ -175,11 +175,14 @@ EXPORT_SYMBOL(comedi_dio_bitfield); int comedi_find_subdevice_by_type(struct comedi_device *dev, int type, unsigned int subd) { + struct comedi_subdevice *s; + if (subd > dev->n_subdevices) return -ENODEV; for (; subd < dev->n_subdevices; subd++) { - if (dev->subdevices[subd].type == type) + s = &dev->subdevices[subd]; + if (s->type == type) return subd; } return -1; @@ -188,7 +191,7 @@ EXPORT_SYMBOL(comedi_find_subdevice_by_type); int comedi_get_n_channels(struct comedi_device *dev, unsigned int subdevice) { - struct comedi_subdevice *s = dev->subdevices + subdevice; + struct comedi_subdevice *s = &dev->subdevices[subdevice]; return s->n_chan; } |