staging: comedi: ni_mio_common: init clock dividers early in ni_E_init()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 14 Jul 2014 19:23:59 +0000 (12:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jul 2014 20:24:43 +0000 (13:24 -0700)
The init/reset of the hardware is a bit scattered in this function. For
aesthetics, move the init of the clock dividers so it happens early and
tidy up the code a bit.

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_mio_common.c

index dc5f927d32ff1c7e50970177db6644482b93fa3a..6d1754f98c2e9c4108ee5d9054a80be65a66949a 100644 (file)
@@ -5499,6 +5499,18 @@ static int ni_E_init(struct comedi_device *dev,
                return -EINVAL;
        }
 
+       /* initialize clock dividers */
+       devpriv->clock_and_fout = Slow_Internal_Time_Divide_By_2 |
+                                 Slow_Internal_Timebase |
+                                 Clock_To_Board_Divide_By_2 |
+                                 Clock_To_Board;
+       if (!devpriv->is_6xxx) {
+               /* BEAM is this needed for PCI-6143 ?? */
+               devpriv->clock_and_fout |= (AI_Output_Divide_By_2 |
+                                           AO_Output_Divide_By_2);
+       }
+       ni_stc_writew(dev, devpriv->clock_and_fout, Clock_and_FOUT_Register);
+
        ret = comedi_alloc_subdevices(dev, NI_NUM_SUBDEVICES);
        if (ret)
                return ret;
@@ -5770,21 +5782,6 @@ static int ni_E_init(struct comedi_device *dev,
        /* ai configuration */
        s = &dev->subdevices[NI_AI_SUBDEV];
        ni_ai_reset(dev, s);
-       if (!devpriv->is_6xxx) {
-               /*  BEAM is this needed for PCI-6143 ?? */
-               devpriv->clock_and_fout =
-                   Slow_Internal_Time_Divide_By_2 |
-                   Slow_Internal_Timebase |
-                   Clock_To_Board_Divide_By_2 |
-                   Clock_To_Board |
-                   AI_Output_Divide_By_2 | AO_Output_Divide_By_2;
-       } else {
-               devpriv->clock_and_fout =
-                   Slow_Internal_Time_Divide_By_2 |
-                   Slow_Internal_Timebase |
-                   Clock_To_Board_Divide_By_2 | Clock_To_Board;
-       }
-       ni_stc_writew(dev, devpriv->clock_and_fout, Clock_and_FOUT_Register);
 
        /* analog output configuration */
        s = &dev->subdevices[NI_AO_SUBDEV];
This page took 0.030538 seconds and 5 git commands to generate.