staging: comedi: ni_tio: absorb ni_tio_set_first_gate_modifiers()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 24 Jul 2014 17:15:01 +0000 (10:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 27 Jul 2014 18:16:49 +0000 (11:16 -0700)
This function is only called by ni_tio_set_gate_src(). For aesthetics,
absorb the code into that function..

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

index eb5458240639f7dc9eb04f35c57778e590488b86..33ffd17cd097955a350f373e08faa546b5472552 100644 (file)
@@ -776,23 +776,6 @@ static void ni_tio_get_clock_src(struct ni_gpct *counter,
        *period_ns = temp64;
 }
 
-static void ni_tio_set_first_gate_modifiers(struct ni_gpct *counter,
-                                           unsigned int gate_source)
-{
-       const unsigned mode_mask = Gi_Gate_Polarity_Bit | Gi_Gating_Mode_Mask;
-       unsigned cidx = counter->counter_index;
-       unsigned mode_values = 0;
-
-       if (gate_source & CR_INVERT)
-               mode_values |= Gi_Gate_Polarity_Bit;
-       if (gate_source & CR_EDGE)
-               mode_values |= Gi_Rising_Edge_Gating_Bits;
-       else
-               mode_values |= Gi_Level_Gating_Bits;
-       ni_tio_set_bits(counter, NITIO_MODE_REG(cidx),
-                       mode_mask, mode_values);
-}
-
 static int ni_660x_set_gate(struct ni_gpct *counter, unsigned int gate_source)
 {
        unsigned int chan = CR_CHAN(gate_source);
@@ -953,6 +936,7 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, unsigned gate_index,
        unsigned cidx = counter->counter_index;
        unsigned int chan = CR_CHAN(gate_source);
        unsigned gate2_reg = NITIO_GATE2_REG(cidx);
+       unsigned mode = 0;
 
        switch (gate_index) {
        case 0:
@@ -962,7 +946,15 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, unsigned gate_index,
                                        Gi_Gating_Disabled_Bits);
                        return 0;
                }
-               ni_tio_set_first_gate_modifiers(counter, gate_source);
+               if (gate_source & CR_INVERT)
+                       mode |= Gi_Gate_Polarity_Bit;
+               if (gate_source & CR_EDGE)
+                       mode |= Gi_Rising_Edge_Gating_Bits;
+               else
+                       mode |= Gi_Level_Gating_Bits;
+               ni_tio_set_bits(counter, NITIO_MODE_REG(cidx),
+                               Gi_Gate_Polarity_Bit | Gi_Gating_Mode_Mask,
+                               mode);
                switch (counter_dev->variant) {
                case ni_gpct_variant_e_series:
                case ni_gpct_variant_m_series: