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

staging: comedi: adv_pci_dio: post increment 'subdev' in (*auto_attach)

For aesthetics, post-increment the 'subdev' index when used to get a
comedi_subdevice pointer instead of incrementing it after the subdevice
is initialized.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c1e07ea2
...@@ -557,38 +557,34 @@ static int pci_dio_auto_attach(struct comedi_device *dev, ...@@ -557,38 +557,34 @@ static int pci_dio_auto_attach(struct comedi_device *dev,
subdev = 0; subdev = 0;
for (i = 0; i < MAX_DI_SUBDEVS; i++) for (i = 0; i < MAX_DI_SUBDEVS; i++)
if (board->sdi[i].chans) { if (board->sdi[i].chans) {
s = &dev->subdevices[subdev]; s = &dev->subdevices[subdev++];
pci_dio_add_di(dev, s, &board->sdi[i]); pci_dio_add_di(dev, s, &board->sdi[i]);
subdev++;
} }
for (i = 0; i < MAX_DO_SUBDEVS; i++) for (i = 0; i < MAX_DO_SUBDEVS; i++)
if (board->sdo[i].chans) { if (board->sdo[i].chans) {
s = &dev->subdevices[subdev]; s = &dev->subdevices[subdev++];
pci_dio_add_do(dev, s, &board->sdo[i]); pci_dio_add_do(dev, s, &board->sdo[i]);
subdev++;
} }
for (i = 0; i < MAX_DIO_SUBDEVG; i++) for (i = 0; i < MAX_DIO_SUBDEVG; i++)
for (j = 0; j < board->sdio[i].regs; j++) { for (j = 0; j < board->sdio[i].regs; j++) {
s = &dev->subdevices[subdev]; s = &dev->subdevices[subdev++];
ret = subdev_8255_init(dev, s, NULL, ret = subdev_8255_init(dev, s, NULL,
board->sdio[i].addr + board->sdio[i].addr +
j * I8255_SIZE); j * I8255_SIZE);
if (ret) if (ret)
return ret; return ret;
subdev++;
} }
if (board->boardid.chans) { if (board->boardid.chans) {
s = &dev->subdevices[subdev]; s = &dev->subdevices[subdev++];
s->type = COMEDI_SUBD_DI; s->type = COMEDI_SUBD_DI;
pci_dio_add_di(dev, s, &board->boardid); pci_dio_add_di(dev, s, &board->boardid);
subdev++;
} }
if (board->timer_regbase) { if (board->timer_regbase) {
s = &dev->subdevices[subdev]; s = &dev->subdevices[subdev++];
dev->pacer = comedi_8254_init(dev->iobase + dev->pacer = comedi_8254_init(dev->iobase +
board->timer_regbase, board->timer_regbase,
...@@ -597,8 +593,6 @@ static int pci_dio_auto_attach(struct comedi_device *dev, ...@@ -597,8 +593,6 @@ static int pci_dio_auto_attach(struct comedi_device *dev,
return -ENOMEM; return -ENOMEM;
comedi_8254_subdevice_init(s, dev->pacer); comedi_8254_subdevice_init(s, dev->pacer);
subdev++;
} }
pci_dio_reset(dev); pci_dio_reset(dev);
......
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