Merge tag 'defconfig-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-2.6-microblaze.git] / drivers / counter / ti-eqep.c
index 65df9ef..94fe58b 100644 (file)
@@ -157,7 +157,7 @@ static int ti_eqep_action_get(struct counter_device *counter,
                 * QEPA and QEPB trigger QCLK.
                 */
                *action = TI_EQEP_SYNAPSE_ACTION_BOTH_EDGES;
-               break;
+               return 0;
        case TI_EQEP_COUNT_FUNC_DIR_COUNT:
                /* In direction-count mode only rising edge of QEPA is counted
                 * and QEPB gives direction.
@@ -165,12 +165,14 @@ static int ti_eqep_action_get(struct counter_device *counter,
                switch (synapse->signal->id) {
                case TI_EQEP_SIGNAL_QEPA:
                        *action = TI_EQEP_SYNAPSE_ACTION_RISING_EDGE;
-                       break;
-               default:
+                       return 0;
+               case TI_EQEP_SIGNAL_QEPB:
                        *action = TI_EQEP_SYNAPSE_ACTION_NONE;
-                       break;
+                       return 0;
+               default:
+                       /* should never reach this path */
+                       return -EINVAL;
                }
-               break;
        case TI_EQEP_COUNT_FUNC_UP_COUNT:
        case TI_EQEP_COUNT_FUNC_DOWN_COUNT:
                /* In up/down-count modes only QEPA is counted and QEPB is not
@@ -186,15 +188,18 @@ static int ti_eqep_action_get(struct counter_device *counter,
                                *action = TI_EQEP_SYNAPSE_ACTION_BOTH_EDGES;
                        else
                                *action = TI_EQEP_SYNAPSE_ACTION_RISING_EDGE;
-                       break;
-               default:
+                       return 0;
+               case TI_EQEP_SIGNAL_QEPB:
                        *action = TI_EQEP_SYNAPSE_ACTION_NONE;
-                       break;
+                       return 0;
+               default:
+                       /* should never reach this path */
+                       return -EINVAL;
                }
-               break;
+       default:
+               /* should never reach this path */
+               return -EINVAL;
        }
-
-       return 0;
 }
 
 static const struct counter_ops ti_eqep_counter_ops = {
@@ -289,11 +294,11 @@ static struct counter_signal ti_eqep_signals[] = {
        },
 };
 
-static const enum counter_count_function ti_eqep_position_functions[] = {
-       [TI_EQEP_COUNT_FUNC_QUAD_COUNT] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
-       [TI_EQEP_COUNT_FUNC_DIR_COUNT]  = COUNTER_COUNT_FUNCTION_PULSE_DIRECTION,
-       [TI_EQEP_COUNT_FUNC_UP_COUNT]   = COUNTER_COUNT_FUNCTION_INCREASE,
-       [TI_EQEP_COUNT_FUNC_DOWN_COUNT] = COUNTER_COUNT_FUNCTION_DECREASE,
+static const enum counter_function ti_eqep_position_functions[] = {
+       [TI_EQEP_COUNT_FUNC_QUAD_COUNT] = COUNTER_FUNCTION_QUADRATURE_X4,
+       [TI_EQEP_COUNT_FUNC_DIR_COUNT]  = COUNTER_FUNCTION_PULSE_DIRECTION,
+       [TI_EQEP_COUNT_FUNC_UP_COUNT]   = COUNTER_FUNCTION_INCREASE,
+       [TI_EQEP_COUNT_FUNC_DOWN_COUNT] = COUNTER_FUNCTION_DECREASE,
 };
 
 static const enum counter_synapse_action ti_eqep_position_synapse_actions[] = {