diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2015-11-18 10:07:05 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-12-21 15:57:40 -0800 |
commit | afe5c118bd07edcb00503bd0f4ab83a6e56ae9d8 (patch) | |
tree | cb693d775209708e7afbc524c470646b0bca8ced | |
parent | c1e07ea22a46c39cbd632233f716ec3a591d94ed (diff) |
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: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/adv_pci_dio.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index b1f966e7f392..4d4b38c1d0fc 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -557,38 +557,34 @@ static int pci_dio_auto_attach(struct comedi_device *dev, subdev = 0; for (i = 0; i < MAX_DI_SUBDEVS; i++) if (board->sdi[i].chans) { - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; pci_dio_add_di(dev, s, &board->sdi[i]); - subdev++; } for (i = 0; i < MAX_DO_SUBDEVS; i++) if (board->sdo[i].chans) { - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; pci_dio_add_do(dev, s, &board->sdo[i]); - subdev++; } for (i = 0; i < MAX_DIO_SUBDEVG; i++) for (j = 0; j < board->sdio[i].regs; j++) { - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; ret = subdev_8255_init(dev, s, NULL, board->sdio[i].addr + j * I8255_SIZE); if (ret) return ret; - subdev++; } if (board->boardid.chans) { - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DI; pci_dio_add_di(dev, s, &board->boardid); - subdev++; } if (board->timer_regbase) { - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; dev->pacer = comedi_8254_init(dev->iobase + board->timer_regbase, @@ -597,8 +593,6 @@ static int pci_dio_auto_attach(struct comedi_device *dev, return -ENOMEM; comedi_8254_subdevice_init(s, dev->pacer); - - subdev++; } pci_dio_reset(dev); |