LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: cgel.zte@gmail.com
To: bamv2005@gmail.com
Cc: shuah@kernel.org, linux-gpio@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chi Minghao <chi.minghao@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: [PATCH] selftest: gpio: undeclared variable
Date: Tue, 31 Aug 2021 03:47:07 -0700	[thread overview]
Message-ID: <20210831104707.16667-1-chi.minghao@zte.com.cn> (raw)

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


                 reply	other threads:[~2021-08-31 10:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210831104707.16667-1-chi.minghao@zte.com.cn \
    --to=cgel.zte@gmail.com \
    --cc=bamv2005@gmail.com \
    --cc=chi.minghao@zte.com.cn \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=zealci@zte.com.cn \
    --subject='Re: [PATCH] selftest: gpio: undeclared variable' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).