gpio: introduce a header for symbols shared by suppliers and consumers
PATCH 1/1 gpio: introduce a header for symbols shared by suppliers and consumers
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.
---
Andy, Linus: I'm no longer sure who proposed it but I've had it on my TODO list. Please feel free to take credit below.
include/linux/gpio/consumer.h | 2 ++ include/linux/gpio/defs.h | 9 +++++++++ include/linux/gpio/driver.h | 5 ++--- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 include/linux/gpio/defs.h
include/linux/gpio/consumer.h +2 -0
@@ -6,6 +6,8 @@#include <linux/err.h> #include <linux/types.h> +#include "defs.h" +struct acpi_device ;struct device ;struct fwnode_handle ;
include/linux/gpio/defs.h new file +9 -0
@@ -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 */
include/linux/gpio/driver.h +2 -3
@@ -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 */
Signature · 1 line
2.47.3
Quoted 5 lines · Bartosz Golaszewski
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.hor - even worse - to redefine these values, create a new header file -gpio/defs.h- and move them over there. Include this header from bothgpio/consumer.handgpio/driver.h.
It was discussed before off the list, but I agree with the direction it goes.
Quoted 4 lines
Signed-off-by Bartosz Golaszewski <[email protected]>---
Andy, Linus: I'm no longer sure who proposed it but I've had it on my TODO list. Please feel free to take credit below.
I believe both, I added mine above.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 10 lines · Bartosz Golaszewski
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.hor - even worse - to redefine these values, create a new header file -gpio/defs.h- and move them over there. Include this header from bothgpio/consumer.handgpio/driver.h.Signed-off-by Bartosz Golaszewski <[email protected]>---
Andy, Linus: I'm no longer sure who proposed it but I've had it on my TODO list. Please feel free to take credit below.
I'm just happy it happens, I ran into the problem.
Yours,
Linus Walleij
Bartosz Golaszewski
AppliedQuoted 8 lines · Bartosz Golaszewski
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.hor - even worse - to redefine these values, create a new header file -gpio/defs.h- and move them over there. Include this header from bothgpio/consumer.handgpio/driver.h.[...]
Applied, thanks!
[1/1] gpio: introduce a header for symbols shared by suppliers and consumers
https://git.kernel.org/brgl/c/fa4a3a95139e7293c1333a33bd7b19e7261e3bd0
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>