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

staging: comedi: cb_pcidas64: 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 e89c61b9
...@@ -1348,7 +1348,7 @@ static int setup_subdevices(struct comedi_device *dev) ...@@ -1348,7 +1348,7 @@ static int setup_subdevices(struct comedi_device *dev)
if (ret) if (ret)
return ret; return ret;
s = dev->subdevices + 0; s = &dev->subdevices[0];
/* analog input subdevice */ /* analog input subdevice */
dev->read_subdev = s; dev->read_subdev = s;
s->type = COMEDI_SUBD_AI; s->type = COMEDI_SUBD_AI;
...@@ -1379,7 +1379,7 @@ static int setup_subdevices(struct comedi_device *dev) ...@@ -1379,7 +1379,7 @@ static int setup_subdevices(struct comedi_device *dev)
} }
/* analog output subdevice */ /* analog output subdevice */
s = dev->subdevices + 1; s = &dev->subdevices[1];
if (board(dev)->ao_nchan) { if (board(dev)->ao_nchan) {
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
s->subdev_flags = s->subdev_flags =
...@@ -1401,7 +1401,7 @@ static int setup_subdevices(struct comedi_device *dev) ...@@ -1401,7 +1401,7 @@ static int setup_subdevices(struct comedi_device *dev)
} }
/* digital input */ /* digital input */
s = dev->subdevices + 2; s = &dev->subdevices[2];
if (board(dev)->layout == LAYOUT_64XX) { if (board(dev)->layout == LAYOUT_64XX) {
s->type = COMEDI_SUBD_DI; s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE; s->subdev_flags = SDF_READABLE;
...@@ -1414,7 +1414,7 @@ static int setup_subdevices(struct comedi_device *dev) ...@@ -1414,7 +1414,7 @@ static int setup_subdevices(struct comedi_device *dev)
/* digital output */ /* digital output */
if (board(dev)->layout == LAYOUT_64XX) { if (board(dev)->layout == LAYOUT_64XX) {
s = dev->subdevices + 3; s = &dev->subdevices[3];
s->type = COMEDI_SUBD_DO; s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITABLE | SDF_READABLE; s->subdev_flags = SDF_WRITABLE | SDF_READABLE;
s->n_chan = 4; s->n_chan = 4;
...@@ -1425,7 +1425,7 @@ static int setup_subdevices(struct comedi_device *dev) ...@@ -1425,7 +1425,7 @@ static int setup_subdevices(struct comedi_device *dev)
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
/* 8255 */ /* 8255 */
s = dev->subdevices + 4; s = &dev->subdevices[4];
if (board(dev)->has_8255) { if (board(dev)->has_8255) {
if (board(dev)->layout == LAYOUT_4020) { if (board(dev)->layout == LAYOUT_4020) {
dio_8255_iobase = dio_8255_iobase =
...@@ -1442,7 +1442,7 @@ static int setup_subdevices(struct comedi_device *dev) ...@@ -1442,7 +1442,7 @@ static int setup_subdevices(struct comedi_device *dev)
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
/* 8 channel dio for 60xx */ /* 8 channel dio for 60xx */
s = dev->subdevices + 5; s = &dev->subdevices[5];
if (board(dev)->layout == LAYOUT_60XX) { if (board(dev)->layout == LAYOUT_60XX) {
s->type = COMEDI_SUBD_DIO; s->type = COMEDI_SUBD_DIO;
s->subdev_flags = SDF_WRITABLE | SDF_READABLE; s->subdev_flags = SDF_WRITABLE | SDF_READABLE;
...@@ -1455,7 +1455,7 @@ static int setup_subdevices(struct comedi_device *dev) ...@@ -1455,7 +1455,7 @@ static int setup_subdevices(struct comedi_device *dev)
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
/* caldac */ /* caldac */
s = dev->subdevices + 6; s = &dev->subdevices[6];
s->type = COMEDI_SUBD_CALIB; s->type = COMEDI_SUBD_CALIB;
s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL;
s->n_chan = 8; s->n_chan = 8;
...@@ -1469,7 +1469,7 @@ static int setup_subdevices(struct comedi_device *dev) ...@@ -1469,7 +1469,7 @@ static int setup_subdevices(struct comedi_device *dev)
caldac_write(dev, i, s->maxdata / 2); caldac_write(dev, i, s->maxdata / 2);
/* 2 channel ad8402 potentiometer */ /* 2 channel ad8402 potentiometer */
s = dev->subdevices + 7; s = &dev->subdevices[7];
if (board(dev)->layout == LAYOUT_64XX) { if (board(dev)->layout == LAYOUT_64XX) {
s->type = COMEDI_SUBD_CALIB; s->type = COMEDI_SUBD_CALIB;
s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL;
...@@ -1483,7 +1483,7 @@ static int setup_subdevices(struct comedi_device *dev) ...@@ -1483,7 +1483,7 @@ static int setup_subdevices(struct comedi_device *dev)
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
/* serial EEPROM, if present */ /* serial EEPROM, if present */
s = dev->subdevices + 8; s = &dev->subdevices[8];
if (readl(priv(dev)->plx9080_iobase + PLX_CONTROL_REG) & CTL_EECHK) { if (readl(priv(dev)->plx9080_iobase + PLX_CONTROL_REG) & CTL_EECHK) {
s->type = COMEDI_SUBD_MEMORY; s->type = COMEDI_SUBD_MEMORY;
s->subdev_flags = SDF_READABLE | SDF_INTERNAL; s->subdev_flags = SDF_READABLE | SDF_INTERNAL;
...@@ -1494,7 +1494,7 @@ static int setup_subdevices(struct comedi_device *dev) ...@@ -1494,7 +1494,7 @@ static int setup_subdevices(struct comedi_device *dev)
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
/* user counter subd XXX */ /* user counter subd XXX */
s = dev->subdevices + 9; s = &dev->subdevices[9];
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
return 0; return 0;
...@@ -1847,7 +1847,7 @@ static void detach(struct comedi_device *dev) ...@@ -1847,7 +1847,7 @@ static void detach(struct comedi_device *dev)
} }
} }
if (dev->subdevices) if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 4); subdev_8255_cleanup(dev, &dev->subdevices[4]);
if (pcidev) { if (pcidev) {
if (dev->iobase) if (dev->iobase)
comedi_pci_disable(pcidev); comedi_pci_disable(pcidev);
......
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