Commit 5818e709 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: kcomedilib: 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 d3d1e253
......@@ -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;
}
......
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