staging: comedi: ni_660x: initialize the counter with the subdevice init
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 22 Mar 2016 18:10:46 +0000 (11:10 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
Remove the extra for loop and just initialize the counter as the subdevices
are created.

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>
drivers/staging/comedi/drivers/ni_660x.c

index 6366303801003b1f3ad2f5da585699af8b14a3f3..5969723b61672d365b83c20977497bb943d23388 100644 (file)
@@ -1021,14 +1021,13 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
                        s->buf_change   = ni_660x_buf_change;
                        s->async_dma_dir = DMA_BIDIRECTIONAL;
                        s->private      = counter;
+
+                       ni_tio_init_counter(counter);
                } else {
                        s->type         = COMEDI_SUBD_UNUSED;
                }
        }
 
-       for (i = 0; i < n_counters; ++i)
-               ni_tio_init_counter(&gpct_dev->counters[i]);
-
         /*
          * Default the DIO channels as:
          *   chan 0-7:  DIO inputs