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

staging: comedi: cb_pcidas: 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 3d69288a
...@@ -1560,7 +1560,7 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev, ...@@ -1560,7 +1560,7 @@ static int cb_pcidas_attach_pci(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;
...@@ -1577,7 +1577,7 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev, ...@@ -1577,7 +1577,7 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev,
s->cancel = cb_pcidas_cancel; s->cancel = cb_pcidas_cancel;
/* analog output subdevice */ /* analog output subdevice */
s = dev->subdevices + 1; s = &dev->subdevices[1];
if (thisboard->ao_nchan) { if (thisboard->ao_nchan) {
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND;
...@@ -1604,14 +1604,14 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev, ...@@ -1604,14 +1604,14 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev,
} }
/* 8255 */ /* 8255 */
s = dev->subdevices + 2; s = &dev->subdevices[2];
ret = subdev_8255_init(dev, s, NULL, ret = subdev_8255_init(dev, s, NULL,
devpriv->pacer_counter_dio + DIO_8255); devpriv->pacer_counter_dio + DIO_8255);
if (ret) if (ret)
return ret; return ret;
/* serial EEPROM, */ /* serial EEPROM, */
s = dev->subdevices + 3; s = &dev->subdevices[3];
s->type = COMEDI_SUBD_MEMORY; s->type = COMEDI_SUBD_MEMORY;
s->subdev_flags = SDF_READABLE | SDF_INTERNAL; s->subdev_flags = SDF_READABLE | SDF_INTERNAL;
s->n_chan = 256; s->n_chan = 256;
...@@ -1619,7 +1619,7 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev, ...@@ -1619,7 +1619,7 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev,
s->insn_read = eeprom_read_insn; s->insn_read = eeprom_read_insn;
/* 8800 caldac */ /* 8800 caldac */
s = dev->subdevices + 4; s = &dev->subdevices[4];
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 = NUM_CHANNELS_8800; s->n_chan = NUM_CHANNELS_8800;
...@@ -1630,7 +1630,7 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev, ...@@ -1630,7 +1630,7 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev,
caldac_8800_write(dev, i, s->maxdata / 2); caldac_8800_write(dev, i, s->maxdata / 2);
/* trim potentiometer */ /* trim potentiometer */
s = dev->subdevices + 5; s = &dev->subdevices[5];
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;
if (thisboard->trimpot == AD7376) { if (thisboard->trimpot == AD7376) {
...@@ -1646,7 +1646,7 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev, ...@@ -1646,7 +1646,7 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev,
cb_pcidas_trimpot_write(dev, i, s->maxdata / 2); cb_pcidas_trimpot_write(dev, i, s->maxdata / 2);
/* dac08 caldac */ /* dac08 caldac */
s = dev->subdevices + 6; s = &dev->subdevices[6];
if (thisboard->has_dac08) { if (thisboard->has_dac08) {
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;
...@@ -1688,7 +1688,7 @@ static void cb_pcidas_detach(struct comedi_device *dev) ...@@ -1688,7 +1688,7 @@ static void cb_pcidas_detach(struct comedi_device *dev)
if (dev->irq) if (dev->irq)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->subdevices) if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 2); subdev_8255_cleanup(dev, &dev->subdevices[2]);
if (pcidev) { if (pcidev) {
if (devpriv->s5933_config) if (devpriv->s5933_config)
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