]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
counter: Rename counter_count_function to counter_function
authorWilliam Breathitt Gray <vilhelm.gray@gmail.com>
Tue, 3 Aug 2021 12:06:15 +0000 (21:06 +0900)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 9 Aug 2021 19:17:36 +0000 (20:17 +0100)
The phrase "Counter Count function" is verbose and unintentionally
implies that function is a Count extension. This patch adjusts the
Counter subsystem code to use the more direct "Counter function" phrase
to make the intent of this code clearer.

Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: Patrick Havelange <patrick.havelange@essensium.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: David Lechner <david@lechnology.com>
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/8268c54d6f42075a19bb08151a37831e22652499.1627990337.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/counter/104-quad-8.c
drivers/counter/counter.c
drivers/counter/ftm-quaddec.c
drivers/counter/intel-qep.c
drivers/counter/interrupt-cnt.c
drivers/counter/microchip-tcb-capture.c
drivers/counter/stm32-lptimer-cnt.c
drivers/counter/stm32-timer-cnt.c
drivers/counter/ti-eqep.c
include/linux/counter.h

index b4dd07cf51ebc84257579a245731a5ee0cc76a6b..5283ff128c171958054e7abde5ff40b5c5b525fb 100644 (file)
@@ -194,11 +194,11 @@ enum quad8_count_function {
        QUAD8_COUNT_FUNCTION_QUADRATURE_X4
 };
 
-static const enum counter_count_function quad8_count_functions_list[] = {
-       [QUAD8_COUNT_FUNCTION_PULSE_DIRECTION] = COUNTER_COUNT_FUNCTION_PULSE_DIRECTION,
-       [QUAD8_COUNT_FUNCTION_QUADRATURE_X1] = COUNTER_COUNT_FUNCTION_QUADRATURE_X1_A,
-       [QUAD8_COUNT_FUNCTION_QUADRATURE_X2] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A,
-       [QUAD8_COUNT_FUNCTION_QUADRATURE_X4] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4
+static const enum counter_function quad8_count_functions_list[] = {
+       [QUAD8_COUNT_FUNCTION_PULSE_DIRECTION] = COUNTER_FUNCTION_PULSE_DIRECTION,
+       [QUAD8_COUNT_FUNCTION_QUADRATURE_X1] = COUNTER_FUNCTION_QUADRATURE_X1_A,
+       [QUAD8_COUNT_FUNCTION_QUADRATURE_X2] = COUNTER_FUNCTION_QUADRATURE_X2_A,
+       [QUAD8_COUNT_FUNCTION_QUADRATURE_X4] = COUNTER_FUNCTION_QUADRATURE_X4
 };
 
 static int quad8_function_get(struct counter_device *counter,
index cb92673552b508846b5af03470b824426062ba2e..de921e8a3f721e5b111c2b49cccb70c51301fbd7 100644 (file)
@@ -744,15 +744,15 @@ static ssize_t counter_count_store(struct device *dev,
        return len;
 }
 
-static const char *const counter_count_function_str[] = {
-       [COUNTER_COUNT_FUNCTION_INCREASE] = "increase",
-       [COUNTER_COUNT_FUNCTION_DECREASE] = "decrease",
-       [COUNTER_COUNT_FUNCTION_PULSE_DIRECTION] = "pulse-direction",
-       [COUNTER_COUNT_FUNCTION_QUADRATURE_X1_A] = "quadrature x1 a",
-       [COUNTER_COUNT_FUNCTION_QUADRATURE_X1_B] = "quadrature x1 b",
-       [COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A] = "quadrature x2 a",
-       [COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B] = "quadrature x2 b",
-       [COUNTER_COUNT_FUNCTION_QUADRATURE_X4] = "quadrature x4"
+static const char *const counter_function_str[] = {
+       [COUNTER_FUNCTION_INCREASE] = "increase",
+       [COUNTER_FUNCTION_DECREASE] = "decrease",
+       [COUNTER_FUNCTION_PULSE_DIRECTION] = "pulse-direction",
+       [COUNTER_FUNCTION_QUADRATURE_X1_A] = "quadrature x1 a",
+       [COUNTER_FUNCTION_QUADRATURE_X1_B] = "quadrature x1 b",
+       [COUNTER_FUNCTION_QUADRATURE_X2_A] = "quadrature x2 a",
+       [COUNTER_FUNCTION_QUADRATURE_X2_B] = "quadrature x2 b",
+       [COUNTER_FUNCTION_QUADRATURE_X4] = "quadrature x4"
 };
 
 static ssize_t counter_function_show(struct device *dev,
@@ -764,7 +764,7 @@ static ssize_t counter_function_show(struct device *dev,
        const struct counter_count_unit *const component = devattr->component;
        struct counter_count *const count = component->count;
        size_t func_index;
-       enum counter_count_function function;
+       enum counter_function function;
 
        err = counter->ops->function_get(counter, count, &func_index);
        if (err)
@@ -773,7 +773,7 @@ static ssize_t counter_function_show(struct device *dev,
        count->function = func_index;
 
        function = count->functions_list[func_index];
-       return sprintf(buf, "%s\n", counter_count_function_str[function]);
+       return sprintf(buf, "%s\n", counter_function_str[function]);
 }
 
 static ssize_t counter_function_store(struct device *dev,
@@ -785,14 +785,14 @@ static ssize_t counter_function_store(struct device *dev,
        struct counter_count *const count = component->count;
        const size_t num_functions = count->num_functions;
        size_t func_index;
-       enum counter_count_function function;
+       enum counter_function function;
        int err;
        struct counter_device *const counter = dev_get_drvdata(dev);
 
        /* Find requested Count function mode */
        for (func_index = 0; func_index < num_functions; func_index++) {
                function = count->functions_list[func_index];
-               if (sysfs_streq(buf, counter_count_function_str[function]))
+               if (sysfs_streq(buf, counter_function_str[function]))
                        break;
        }
        /* Return error if requested Count function mode not found */
@@ -880,25 +880,25 @@ err_free_attr_list:
 }
 
 struct counter_func_avail_unit {
-       const enum counter_count_function *functions_list;
+       const enum counter_function *functions_list;
        size_t num_functions;
 };
 
-static ssize_t counter_count_function_available_show(struct device *dev,
+static ssize_t counter_function_available_show(struct device *dev,
        struct device_attribute *attr, char *buf)
 {
        const struct counter_device_attr *const devattr = to_counter_attr(attr);
        const struct counter_func_avail_unit *const component = devattr->component;
-       const enum counter_count_function *const func_list = component->functions_list;
+       const enum counter_function *const func_list = component->functions_list;
        const size_t num_functions = component->num_functions;
        size_t i;
-       enum counter_count_function function;
+       enum counter_function function;
        ssize_t len = 0;
 
        for (i = 0; i < num_functions; i++) {
                function = func_list[i];
                len += sprintf(buf + len, "%s\n",
-                              counter_count_function_str[function]);
+                              counter_function_str[function]);
        }
 
        return len;
@@ -968,7 +968,7 @@ static int counter_count_attributes_create(
        parm.group = group;
        parm.prefix = "";
        parm.name = "function_available";
-       parm.show = counter_count_function_available_show;
+       parm.show = counter_function_available_show;
        parm.store = NULL;
        parm.component = avail_comp;
        err = counter_attribute_create(&parm);
index 9371532406ca282ed804d0ea314dd4c596cd5f80..53c15f84909b9be6c3ef02fee1f244f203629844 100644 (file)
@@ -171,9 +171,8 @@ enum ftm_quaddec_count_function {
        FTM_QUADDEC_COUNT_ENCODER_MODE_1,
 };
 
-static const enum counter_count_function ftm_quaddec_count_functions[] = {
-       [FTM_QUADDEC_COUNT_ENCODER_MODE_1] =
-       COUNTER_COUNT_FUNCTION_QUADRATURE_X4
+static const enum counter_function ftm_quaddec_count_functions[] = {
+       [FTM_QUADDEC_COUNT_ENCODER_MODE_1] = COUNTER_FUNCTION_QUADRATURE_X4
 };
 
 static int ftm_quaddec_count_read(struct counter_device *counter,
index 204f94577666637f9d2e3d9e74d4c599733b4af7..8a6847d5fb2bd655c2f92658fcb08a4876f098a2 100644 (file)
@@ -126,8 +126,8 @@ static int intel_qep_count_read(struct counter_device *counter,
        return 0;
 }
 
-static const enum counter_count_function intel_qep_count_functions[] = {
-       COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
+static const enum counter_function intel_qep_count_functions[] = {
+       COUNTER_FUNCTION_QUADRATURE_X4,
 };
 
 static int intel_qep_function_get(struct counter_device *counter,
index d06367bef8f0ca18b2509bfe66c6cdd17472698d..1de4243db488c7baab33f908f48a0efe0928204a 100644 (file)
@@ -115,8 +115,8 @@ static int interrupt_cnt_write(struct counter_device *counter,
        return 0;
 }
 
-static const enum counter_count_function interrupt_cnt_functions[] = {
-       COUNTER_COUNT_FUNCTION_INCREASE,
+static const enum counter_function interrupt_cnt_functions[] = {
+       COUNTER_FUNCTION_INCREASE,
 };
 
 static int interrupt_cnt_function_get(struct counter_device *counter,
index 6be3adf741142be9cede1b7e3f04eedd1923f008..1aa70b9c4833098c58deb8d584ed819c95f24b1f 100644 (file)
@@ -37,9 +37,9 @@ enum mchp_tc_count_function {
        MCHP_TC_FUNCTION_QUADRATURE,
 };
 
-static const enum counter_count_function mchp_tc_count_functions[] = {
-       [MCHP_TC_FUNCTION_INCREASE] = COUNTER_COUNT_FUNCTION_INCREASE,
-       [MCHP_TC_FUNCTION_QUADRATURE] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
+static const enum counter_function mchp_tc_count_functions[] = {
+       [MCHP_TC_FUNCTION_INCREASE] = COUNTER_FUNCTION_INCREASE,
+       [MCHP_TC_FUNCTION_QUADRATURE] = COUNTER_FUNCTION_QUADRATURE_X4,
 };
 
 enum mchp_tc_synapse_action {
index 49aeb9e393f391512b39de5236bf8390ae629edb..13656957c45f12768d537c02cc4c3af59bc8fc66 100644 (file)
@@ -134,9 +134,9 @@ enum stm32_lptim_cnt_function {
        STM32_LPTIM_ENCODER_BOTH_EDGE,
 };
 
-static const enum counter_count_function stm32_lptim_cnt_functions[] = {
-       [STM32_LPTIM_COUNTER_INCREASE] = COUNTER_COUNT_FUNCTION_INCREASE,
-       [STM32_LPTIM_ENCODER_BOTH_EDGE] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
+static const enum counter_function stm32_lptim_cnt_functions[] = {
+       [STM32_LPTIM_COUNTER_INCREASE] = COUNTER_FUNCTION_INCREASE,
+       [STM32_LPTIM_ENCODER_BOTH_EDGE] = COUNTER_FUNCTION_QUADRATURE_X4,
 };
 
 enum stm32_lptim_synapse_action {
index 603b30ada839693e53948824aed5cc7a72e51a30..3fb0debd7425d10e14c4185b6f92169371ca3468 100644 (file)
@@ -50,11 +50,11 @@ enum stm32_count_function {
        STM32_COUNT_ENCODER_MODE_3,
 };
 
-static const enum counter_count_function stm32_count_functions[] = {
-       [STM32_COUNT_SLAVE_MODE_DISABLED] = COUNTER_COUNT_FUNCTION_INCREASE,
-       [STM32_COUNT_ENCODER_MODE_1] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A,
-       [STM32_COUNT_ENCODER_MODE_2] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B,
-       [STM32_COUNT_ENCODER_MODE_3] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
+static const enum counter_function stm32_count_functions[] = {
+       [STM32_COUNT_SLAVE_MODE_DISABLED] = COUNTER_FUNCTION_INCREASE,
+       [STM32_COUNT_ENCODER_MODE_1] = COUNTER_FUNCTION_QUADRATURE_X2_A,
+       [STM32_COUNT_ENCODER_MODE_2] = COUNTER_FUNCTION_QUADRATURE_X2_B,
+       [STM32_COUNT_ENCODER_MODE_3] = COUNTER_FUNCTION_QUADRATURE_X4,
 };
 
 static int stm32_count_read(struct counter_device *counter,
index c303eb17c1111a9f8e396eb8f37f3da910d2ed56..94fe58bb3eab3cdacfa9c82faeb0923861e0dbd4 100644 (file)
@@ -294,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[] = {
index 79f5dcaf6ba0b705b5a99938d521f44054a6625a..d16ce2819b48be2d25e09ea1617b839da46b1b61 100644 (file)
@@ -162,15 +162,15 @@ struct counter_count_ext {
        void *priv;
 };
 
-enum counter_count_function {
-       COUNTER_COUNT_FUNCTION_INCREASE = 0,
-       COUNTER_COUNT_FUNCTION_DECREASE,
-       COUNTER_COUNT_FUNCTION_PULSE_DIRECTION,
-       COUNTER_COUNT_FUNCTION_QUADRATURE_X1_A,
-       COUNTER_COUNT_FUNCTION_QUADRATURE_X1_B,
-       COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A,
-       COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B,
-       COUNTER_COUNT_FUNCTION_QUADRATURE_X4
+enum counter_function {
+       COUNTER_FUNCTION_INCREASE = 0,
+       COUNTER_FUNCTION_DECREASE,
+       COUNTER_FUNCTION_PULSE_DIRECTION,
+       COUNTER_FUNCTION_QUADRATURE_X1_A,
+       COUNTER_FUNCTION_QUADRATURE_X1_B,
+       COUNTER_FUNCTION_QUADRATURE_X2_A,
+       COUNTER_FUNCTION_QUADRATURE_X2_B,
+       COUNTER_FUNCTION_QUADRATURE_X4
 };
 
 /**
@@ -192,7 +192,7 @@ struct counter_count {
        const char *name;
 
        size_t function;
-       const enum counter_count_function *functions_list;
+       const enum counter_function *functions_list;
        size_t num_functions;
 
        struct counter_synapse *synapses;