2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-24 06:35:44 +08:00

staging: comedi: aio_aio12_8: 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>
This commit is contained in:
H Hartley Sweeten 2012-09-05 18:28:42 -07:00 committed by Greg Kroah-Hartman
parent 9e006a70e9
commit ef83beae68

View File

@ -221,7 +221,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev,
if (ret) if (ret)
return ret; return ret;
s = dev->subdevices + 0; s = &dev->subdevices[0];
if (board->ai_nchan) { if (board->ai_nchan) {
/* Analog input subdevice */ /* Analog input subdevice */
s->type = COMEDI_SUBD_AI; s->type = COMEDI_SUBD_AI;
@ -234,7 +234,7 @@ static int aio_aio12_8_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->ao_nchan) { if (board->ao_nchan) {
/* Analog output subdevice */ /* Analog output subdevice */
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
@ -248,14 +248,14 @@ static int aio_aio12_8_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
s = dev->subdevices + 2; s = &dev->subdevices[2];
/* 8255 Digital i/o subdevice */ /* 8255 Digital i/o subdevice */
iobase = dev->iobase + AIO12_8_8255_BASE_REG; iobase = dev->iobase + AIO12_8_8255_BASE_REG;
ret = subdev_8255_init(dev, s, NULL, iobase); ret = subdev_8255_init(dev, s, NULL, iobase);
if (ret) if (ret)
return ret; return ret;
s = dev->subdevices + 3; s = &dev->subdevices[3];
/* 8254 counter/timer subdevice */ /* 8254 counter/timer subdevice */
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
@ -268,7 +268,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev,
static void aio_aio12_8_detach(struct comedi_device *dev) static void aio_aio12_8_detach(struct comedi_device *dev)
{ {
if (dev->subdevices) if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 2); subdev_8255_cleanup(dev, &dev->subdevices[2]);
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, 24); release_region(dev->iobase, 24);
} }