From: H Hartley Sweeten Date: Fri, 13 Nov 2015 18:11:20 +0000 (-0700) Subject: staging: comedi: adv_pci1710: post increment 'subdev' in (*auto_attach) X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d3e8ab48db7fdb7b4898d3685f49720a46925902;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: comedi: adv_pci1710: 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index f68cb1a6836e..e36b54045eb4 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -791,7 +791,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, subdev = 0; /* Analog Input subdevice */ - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_GROUND; if (!board->is_pci1711) @@ -817,11 +817,9 @@ static int pci1710_auto_attach(struct comedi_device *dev, } } - subdev++; - if (board->has_ao) { /* Analog Output subdevice */ - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE | SDF_GROUND; s->n_chan = 2; @@ -832,33 +830,29 @@ static int pci1710_auto_attach(struct comedi_device *dev, ret = comedi_alloc_subdev_readback(s); if (ret) return ret; - - subdev++; } if (!board->is_pci1713) { /* Digital Input subdevice */ - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE; s->n_chan = 16; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = pci1710_di_insn_bits; - subdev++; /* Digital Output subdevice */ - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_WRITABLE; s->n_chan = 16; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = pci1710_do_insn_bits; - subdev++; /* Counter subdevice (8254) */ - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; comedi_8254_subdevice_init(s, dev->pacer); dev->pacer->insn_config = pci1710_counter_insn_config; @@ -866,8 +860,6 @@ static int pci1710_auto_attach(struct comedi_device *dev, /* counters 1 and 2 are used internally for the pacer */ comedi_8254_set_busy(dev->pacer, 1, true); comedi_8254_set_busy(dev->pacer, 2, true); - - subdev++; } /* max_samples is half the FIFO size (2 bytes/sample) */