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

staging: comedi: ni_65xx: 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 3d30dca5
...@@ -478,7 +478,7 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev, ...@@ -478,7 +478,7 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev,
static irqreturn_t ni_65xx_interrupt(int irq, void *d) static irqreturn_t ni_65xx_interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->subdevices + 2; struct comedi_subdevice *s = &dev->subdevices[2];
unsigned int status; unsigned int status;
status = readb(private(dev)->mite->daq_io_addr + Change_Status); status = readb(private(dev)->mite->daq_io_addr + Change_Status);
...@@ -678,7 +678,7 @@ static int ni_65xx_attach(struct comedi_device *dev, ...@@ -678,7 +678,7 @@ static int ni_65xx_attach(struct comedi_device *dev,
if (ret) if (ret)
return ret; return ret;
s = dev->subdevices + 0; s = &dev->subdevices[0];
if (board(dev)->num_di_ports) { if (board(dev)->num_di_ports) {
s->type = COMEDI_SUBD_DI; s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE; s->subdev_flags = SDF_READABLE;
...@@ -696,7 +696,7 @@ static int ni_65xx_attach(struct comedi_device *dev, ...@@ -696,7 +696,7 @@ static int ni_65xx_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
s = dev->subdevices + 1; s = &dev->subdevices[1];
if (board(dev)->num_do_ports) { if (board(dev)->num_do_ports) {
s->type = COMEDI_SUBD_DO; s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_READABLE | SDF_WRITABLE; s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
...@@ -713,7 +713,7 @@ static int ni_65xx_attach(struct comedi_device *dev, ...@@ -713,7 +713,7 @@ static int ni_65xx_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
s = dev->subdevices + 2; s = &dev->subdevices[2];
if (board(dev)->num_dio_ports) { if (board(dev)->num_dio_ports) {
s->type = COMEDI_SUBD_DIO; s->type = COMEDI_SUBD_DIO;
s->subdev_flags = SDF_READABLE | SDF_WRITABLE; s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
...@@ -737,7 +737,7 @@ static int ni_65xx_attach(struct comedi_device *dev, ...@@ -737,7 +737,7 @@ static int ni_65xx_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
s = dev->subdevices + 3; s = &dev->subdevices[3];
dev->read_subdev = s; dev->read_subdev = s;
s->type = COMEDI_SUBD_DI; s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE | SDF_CMD_READ; s->subdev_flags = SDF_READABLE | SDF_CMD_READ;
...@@ -791,10 +791,13 @@ static void ni_65xx_detach(struct comedi_device *dev) ...@@ -791,10 +791,13 @@ static void ni_65xx_detach(struct comedi_device *dev)
if (dev->irq) if (dev->irq)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (private(dev)) { if (private(dev)) {
struct comedi_subdevice *s;
unsigned i; unsigned i;
for (i = 0; i < dev->n_subdevices; ++i) { for (i = 0; i < dev->n_subdevices; ++i) {
kfree(dev->subdevices[i].private); s = &dev->subdevices[i];
dev->subdevices[i].private = NULL; kfree(s->private);
s->private = NULL;
} }
if (private(dev)->mite) if (private(dev)->mite)
mite_unsetup(private(dev)->mite); mite_unsetup(private(dev)->mite);
......
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