LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] selftest: gpio: undeclared variable
@ 2021-08-31 10:47 cgel.zte
0 siblings, 0 replies; only message in thread
From: cgel.zte @ 2021-08-31 10:47 UTC (permalink / raw)
To: bamv2005
Cc: shuah, linux-gpio, linux-kselftest, linux-kernel, Chi Minghao,
Zeal Robot
From: Chi Minghao <chi.minghao@zte.com.cn>
Add undeclared variable
Fixes: shortid ("undeclared variable")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Chi Minghao <chi.minghao@zte.com.cn>
---
.../testing/selftests/gpio/gpio-mockup-cdev.c | 57 +++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/tools/testing/selftests/gpio/gpio-mockup-cdev.c b/tools/testing/selftests/gpio/gpio-mockup-cdev.c
index e83eac71621a..83a32b8835d3 100644
--- a/tools/testing/selftests/gpio/gpio-mockup-cdev.c
+++ b/tools/testing/selftests/gpio/gpio-mockup-cdev.c
@@ -15,9 +15,66 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/gpio.h>
+#include <linux/const.h>
+#include <linux/ioctl.h>
+#include <linux/types.h>
#define CONSUMER "gpio-mockup-cdev"
+#define GPIO_V2_LINE_NUM_ATTRS_MAX 10
+#define GPIO_V2_LINES_MAX 64
+#define GPIO_MAX_NAME_SIZE 32
+
+#define GPIOHANDLE_REQUEST_BIAS_PULL_UP (1UL << 5)
+#define GPIOHANDLE_REQUEST_BIAS_DISABLE (1UL << 7)
+#define GPIOHANDLE_REQUEST_BIAS_PULL_DOWN (1UL << 6)
+#define GPIO_V2_LINE_GET_VALUES_IOCTL _IOWR(0xB4, 0x0E, struct gpio_v2_line_values)
+#define GPIO_V2_GET_LINE_IOCTL _IOWR(0xB4, 0x07, struct gpio_v2_line_request)
+
+enum gpio_v2_line_flag {
+ GPIO_V2_LINE_FLAG_ACTIVE_LOW = _BITULL(1),
+ GPIO_V2_LINE_FLAG_INPUT = _BITULL(2),
+ GPIO_V2_LINE_FLAG_OUTPUT = _BITULL(3),
+ GPIO_V2_LINE_FLAG_BIAS_PULL_UP = _BITULL(8),
+ GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN = _BITULL(9),
+ GPIO_V2_LINE_FLAG_BIAS_DISABLED = _BITULL(10),
+};
+enum gpio_v2_line_attr_id {
+ GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES = 2,
+};
+struct gpio_v2_line_values {
+ __aligned_u64 bits;
+ __aligned_u64 mask;
+};
+struct gpio_v2_line_attribute {
+ __u32 id;
+ __u32 padding;
+ union {
+ __aligned_u64 flags;
+ __aligned_u64 values;
+ __u32 debounce_period_us;
+ };
+};
+struct gpio_v2_line_config_attribute {
+ struct gpio_v2_line_attribute attr;
+ __aligned_u64 mask;
+};
+struct gpio_v2_line_config {
+ __aligned_u64 flags;
+ __u32 num_attrs;
+ __u32 padding[5];
+ struct gpio_v2_line_config_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
+};
+struct gpio_v2_line_request {
+ __u32 offsets[GPIO_V2_LINES_MAX];
+ char consumer[GPIO_MAX_NAME_SIZE];
+ struct gpio_v2_line_config config;
+ __u32 num_lines;
+ __u32 event_buffer_size;
+ __u32 padding[5];
+ __s32 fd;
+};
+
static int request_line_v2(int cfd, unsigned int offset,
uint64_t flags, unsigned int val)
{
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-31 10:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31 10:47 [PATCH] selftest: gpio: undeclared variable cgel.zte
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).