]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gpio: introduce a header for symbols shared by suppliers and consumers
authorBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Mon, 23 Feb 2026 17:20:06 +0000 (18:20 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Fri, 27 Feb 2026 08:49:43 +0000 (09:49 +0100)
GPIO_LINE_DIRECTION_IN/OUT definitions are used both in supplier (GPIO
controller drivers) as well as consumer code. In order to not force the
consumers to include gpio/driver.h or - even worse - to redefine these
values, create a new header file - gpio/defs.h - and move them over
there. Include this header from both gpio/consumer.h and gpio/driver.h.

Reviewed-by: Linus Walleij <linusw@kernel.org>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260223172006.204268-1-bartosz.golaszewski@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
include/linux/gpio/consumer.h
include/linux/gpio/defs.h [new file with mode: 0644]
include/linux/gpio/driver.h

index 0d8408582918680bfea6a04ccedfc0c75211907a..3efb5cb1e1d16eafaff78a4e9879a431b9d0b55f 100644 (file)
@@ -6,6 +6,8 @@
 #include <linux/err.h>
 #include <linux/types.h>
 
+#include "defs.h"
+
 struct acpi_device;
 struct device;
 struct fwnode_handle;
diff --git a/include/linux/gpio/defs.h b/include/linux/gpio/defs.h
new file mode 100644 (file)
index 0000000..b69fd7c
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __LINUX_GPIO_DEFS_H
+#define __LINUX_GPIO_DEFS_H
+
+#define GPIO_LINE_DIRECTION_IN         1
+#define GPIO_LINE_DIRECTION_OUT                0
+
+#endif /* __LINUX_GPIO_DEFS_H */
index fabe2baf7b509059c9d05cddb3c63eaf8b6f0542..5f5ddcbfa44593ad8d47d11d2ba265b3f51dccb2 100644 (file)
@@ -20,6 +20,8 @@
 #include <asm/msi.h>
 #endif
 
+#include "defs.h"
+
 struct device;
 struct irq_chip;
 struct irq_data;
@@ -42,9 +44,6 @@ union gpio_irq_fwspec {
 #endif
 };
 
-#define GPIO_LINE_DIRECTION_IN 1
-#define GPIO_LINE_DIRECTION_OUT        0
-
 /**
  * struct gpio_irq_chip - GPIO interrupt controller
  */