summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedi_fops.c
diff options
context:
space:
mode:
authorH Hartley Sweeten2012-09-06 03:20:58 +0200
committerGreg Kroah-Hartman2012-09-06 05:01:35 +0200
commitb077f2cd9b63798c676d62e03c85ace094e2d970 (patch)
tree7936ffbb07665bdbf3a95cffb2fad88ac81a4455 /drivers/staging/comedi/comedi_fops.c
parentstaging: ramster: place ramster codebase on top of new zcache2 codebase (diff)
downloadkernel-qcow2-linux-b077f2cd9b63798c676d62e03c85ace094e2d970.tar.gz
kernel-qcow2-linux-b077f2cd9b63798c676d62e03c85ace094e2d970.tar.xz
kernel-qcow2-linux-b077f2cd9b63798c676d62e03c85ace094e2d970.zip
staging: comedi: comedi_fops: 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/comedi_fops.c')
-rw-r--r--drivers/staging/comedi/comedi_fops.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 7a76f9c07afd..fb2ed2fbb6c8 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -426,7 +426,7 @@ static int do_bufconfig_ioctl(struct comedi_device *dev,
if (bc.subdevice >= dev->n_subdevices || bc.subdevice < 0)
return -EINVAL;
- s = dev->subdevices + bc.subdevice;
+ s = &dev->subdevices[bc.subdevice];
async = s->async;
if (!async) {
@@ -539,7 +539,7 @@ static int do_subdinfo_ioctl(struct comedi_device *dev,
/* fill subdinfo structs */
for (i = 0; i < dev->n_subdevices; i++) {
- s = dev->subdevices + i;
+ s = &dev->subdevices[i];
us = tmp + i;
us->type = s->type;
@@ -617,7 +617,7 @@ static int do_chaninfo_ioctl(struct comedi_device *dev,
if (it.subdev >= dev->n_subdevices)
return -EINVAL;
- s = dev->subdevices + it.subdev;
+ s = &dev->subdevices[it.subdev];
if (it.maxdata_list) {
if (s->maxdata || !s->maxdata_list)
@@ -685,7 +685,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev,
if (bi.subdevice >= dev->n_subdevices || bi.subdevice < 0)
return -EINVAL;
- s = dev->subdevices + bi.subdevice;
+ s = &dev->subdevices[bi.subdevice];
if (s->lock && s->lock != file)
return -EACCES;
@@ -938,7 +938,7 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn,
ret = -EINVAL;
break;
}
- s = dev->subdevices + insn->subdev;
+ s = &dev->subdevices[insn->subdev];
if (!s->async) {
DPRINTK("no async\n");
ret = -EINVAL;
@@ -967,7 +967,7 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn,
ret = -EINVAL;
goto out;
}
- s = dev->subdevices + insn->subdev;
+ s = &dev->subdevices[insn->subdev];
if (s->type == COMEDI_SUBD_UNUSED) {
DPRINTK("%d not usable subdevice\n", insn->subdev);
@@ -1151,7 +1151,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
return -ENODEV;
}
- s = dev->subdevices + user_cmd.subdev;
+ s = &dev->subdevices[user_cmd.subdev];
async = s->async;
if (s->type == COMEDI_SUBD_UNUSED) {
@@ -1301,7 +1301,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
return -ENODEV;
}
- s = dev->subdevices + user_cmd.subdev;
+ s = &dev->subdevices[user_cmd.subdev];
if (s->type == COMEDI_SUBD_UNUSED) {
DPRINTK("%d not valid subdevice\n", user_cmd.subdev);
return -EIO;
@@ -1388,7 +1388,7 @@ static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg,
if (arg >= dev->n_subdevices)
return -EINVAL;
- s = dev->subdevices + arg;
+ s = &dev->subdevices[arg];
spin_lock_irqsave(&s->spin_lock, flags);
if (s->busy || s->lock)
@@ -1431,7 +1431,7 @@ static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg,
if (arg >= dev->n_subdevices)
return -EINVAL;
- s = dev->subdevices + arg;
+ s = &dev->subdevices[arg];
if (s->busy)
return -EBUSY;
@@ -1472,7 +1472,7 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
if (arg >= dev->n_subdevices)
return -EINVAL;
- s = dev->subdevices + arg;
+ s = &dev->subdevices[arg];
if (s->async == NULL)
return -EINVAL;
@@ -1509,7 +1509,7 @@ static int do_poll_ioctl(struct comedi_device *dev, unsigned int arg,
if (arg >= dev->n_subdevices)
return -EINVAL;
- s = dev->subdevices + arg;
+ s = &dev->subdevices[arg];
if (s->lock && s->lock != file)
return -EACCES;
@@ -2138,7 +2138,7 @@ static int comedi_close(struct inode *inode, struct file *file)
if (dev->subdevices) {
for (i = 0; i < dev->n_subdevices; i++) {
- s = dev->subdevices + i;
+ s = &dev->subdevices[i];
if (s->busy == file)
do_cancel(dev, s);
@@ -2359,7 +2359,7 @@ static int is_device_busy(struct comedi_device *dev)
return 0;
for (i = 0; i < dev->n_subdevices; i++) {
- s = dev->subdevices + i;
+ s = &dev->subdevices[i];
if (s->busy)
return 1;
if (s->async && s->async->mmap_count)