[PATCH v13 09/17] counter: Move counter enums to uapi header
From: William Breathitt Gray
Date: Tue Jul 13 2021 - 05:54:36 EST
This is in preparation for a subsequent patch implementing a character
device interface for the Counter subsystem.
Reviewed-by: David Lechner <david@xxxxxxxxxxxxxx>
Signed-off-by: William Breathitt Gray <vilhelm.gray@xxxxxxxxx>
---
MAINTAINERS | 1 +
include/linux/counter.h | 42 +--------------------------
include/uapi/linux/counter.h | 56 ++++++++++++++++++++++++++++++++++++
3 files changed, 58 insertions(+), 41 deletions(-)
create mode 100644 include/uapi/linux/counter.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 372b6966e93c..96bcdde8165b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4748,6 +4748,7 @@ F: Documentation/ABI/testing/sysfs-bus-counter
F: Documentation/driver-api/generic-counter.rst
F: drivers/counter/
F: include/linux/counter.h
+F: include/uapi/linux/counter.h
CP2615 I2C DRIVER
M: Bence Csókás <bence98@xxxxxxxxxx>
diff --git a/include/linux/counter.h b/include/linux/counter.h
index 445f22d8bfe2..7c9f7e23953a 100644
--- a/include/linux/counter.h
+++ b/include/linux/counter.h
@@ -9,6 +9,7 @@
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/types.h>
+#include <uapi/linux/counter.h>
struct counter_device;
struct counter_count;
@@ -27,47 +28,6 @@ enum counter_comp_type {
COUNTER_COMP_COUNT_MODE,
};
-enum counter_scope {
- COUNTER_SCOPE_DEVICE,
- COUNTER_SCOPE_SIGNAL,
- COUNTER_SCOPE_COUNT,
-};
-
-enum counter_count_direction {
- COUNTER_COUNT_DIRECTION_FORWARD,
- COUNTER_COUNT_DIRECTION_BACKWARD,
-};
-
-enum counter_count_mode {
- COUNTER_COUNT_MODE_NORMAL,
- COUNTER_COUNT_MODE_RANGE_LIMIT,
- COUNTER_COUNT_MODE_NON_RECYCLE,
- COUNTER_COUNT_MODE_MODULO_N,
-};
-
-enum counter_function {
- COUNTER_FUNCTION_INCREASE,
- 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,
-};
-
-enum counter_signal_level {
- COUNTER_SIGNAL_LEVEL_LOW,
- COUNTER_SIGNAL_LEVEL_HIGH,
-};
-
-enum counter_synapse_action {
- COUNTER_SYNAPSE_ACTION_NONE,
- COUNTER_SYNAPSE_ACTION_RISING_EDGE,
- COUNTER_SYNAPSE_ACTION_FALLING_EDGE,
- COUNTER_SYNAPSE_ACTION_BOTH_EDGES,
-};
-
/**
* struct counter_comp - Counter component node
* @type: Counter component data type
diff --git a/include/uapi/linux/counter.h b/include/uapi/linux/counter.h
new file mode 100644
index 000000000000..6113938a6044
--- /dev/null
+++ b/include/uapi/linux/counter.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * Userspace ABI for Counter character devices
+ * Copyright (C) 2020 William Breathitt Gray
+ */
+#ifndef _UAPI_COUNTER_H_
+#define _UAPI_COUNTER_H_
+
+/* Component scope definitions */
+enum counter_scope {
+ COUNTER_SCOPE_DEVICE,
+ COUNTER_SCOPE_SIGNAL,
+ COUNTER_SCOPE_COUNT,
+};
+
+/* Count direction values */
+enum counter_count_direction {
+ COUNTER_COUNT_DIRECTION_FORWARD,
+ COUNTER_COUNT_DIRECTION_BACKWARD,
+};
+
+/* Count mode values */
+enum counter_count_mode {
+ COUNTER_COUNT_MODE_NORMAL,
+ COUNTER_COUNT_MODE_RANGE_LIMIT,
+ COUNTER_COUNT_MODE_NON_RECYCLE,
+ COUNTER_COUNT_MODE_MODULO_N,
+};
+
+/* Count function values */
+enum counter_function {
+ COUNTER_FUNCTION_INCREASE,
+ 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,
+};
+
+/* Signal values */
+enum counter_signal_level {
+ COUNTER_SIGNAL_LEVEL_LOW,
+ COUNTER_SIGNAL_LEVEL_HIGH,
+};
+
+/* Action mode values */
+enum counter_synapse_action {
+ COUNTER_SYNAPSE_ACTION_NONE,
+ COUNTER_SYNAPSE_ACTION_RISING_EDGE,
+ COUNTER_SYNAPSE_ACTION_FALLING_EDGE,
+ COUNTER_SYNAPSE_ACTION_BOTH_EDGES,
+};
+
+#endif /* _UAPI_COUNTER_H_ */
--
2.32.0