Follow-up patches will align the barebox pinctrl consumer API with Linux'. So it makes sense to have the header called the same as well. Users of the old pinctrl.h header are unaffected as it will include the new <linux/pinctrl/consumer.h>. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- v1 -> v2: - no change --- include/linux/pinctrl/consumer.h | 61 ++++++++++++++++++++++++++++++++ include/pinctrl.h | 55 +++------------------------- 2 files changed, 65 insertions(+), 51 deletions(-) create mode 100644 include/linux/pinctrl/consumer.h diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h new file mode 100644 index 000000000000..3028f960deb4 --- /dev/null +++ b/include/linux/pinctrl/consumer.h @@ -0,0 +1,61 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef LINUX_PINCTRL_CONSUMER_H +#define LINUX_PINCTRL_CONSUMER_H + +#include <linux/errno.h> + +struct device; +struct device_node; + +#ifdef CONFIG_PINCTRL +int pinctrl_select_state(struct device *dev, const char *state); +int pinctrl_select_state_default(struct device *dev); +int of_pinctrl_select_state(struct device_node *np, const char *state); +int of_pinctrl_select_state_default(struct device_node *np); +int pinctrl_gpio_direction_input(unsigned pin); +int pinctrl_gpio_direction_output(unsigned int pin); +int pinctrl_gpio_get_direction(unsigned pin); +int pinctrl_single_probe(struct device *dev); +#else +static inline int pinctrl_select_state(struct device *dev, const char *state) +{ + return -ENODEV; +} + +static inline int pinctrl_select_state_default(struct device *dev) +{ + return -ENODEV; +} + +static inline int of_pinctrl_select_state(struct device_node *np, const char *state) +{ + return -ENODEV; +} + +static inline int of_pinctrl_select_state_default(struct device_node *np) +{ + return -ENODEV; +} + +static inline int pinctrl_gpio_direction_input(unsigned pin) +{ + return -ENOTSUPP; +} + +static inline int pinctrl_gpio_direction_output(unsigned int pin) +{ + return -ENOTSUPP; +} + +static inline int pinctrl_gpio_get_direction(unsigned pin) +{ + return -ENOTSUPP; +} + +static inline int pinctrl_single_probe(struct device *dev) +{ + return -ENOSYS; +} +#endif + +#endif /* LINUX_PINCTRL_CONSUMER_H */ diff --git a/include/pinctrl.h b/include/pinctrl.h index f0f7c2cc8b3e..4ba7b489345b 100644 --- a/include/pinctrl.h +++ b/include/pinctrl.h @@ -2,7 +2,11 @@ #ifndef PINCTRL_H #define PINCTRL_H +#include <linux/types.h> +#include <linux/pinctrl/consumer.h> + struct pinctrl_device; +struct device_node; struct pinctrl_ops { int (*set_state)(struct pinctrl_device *, struct device_node *); @@ -21,55 +25,4 @@ struct pinctrl_device { int pinctrl_register(struct pinctrl_device *pdev); void pinctrl_unregister(struct pinctrl_device *pdev); -#ifdef CONFIG_PINCTRL -int pinctrl_select_state(struct device *dev, const char *state); -int pinctrl_select_state_default(struct device *dev); -int of_pinctrl_select_state(struct device_node *np, const char *state); -int of_pinctrl_select_state_default(struct device_node *np); -int pinctrl_gpio_direction_input(unsigned pin); -int pinctrl_gpio_direction_output(unsigned int pin); -int pinctrl_gpio_get_direction(unsigned pin); -int pinctrl_single_probe(struct device *dev); -#else -static inline int pinctrl_select_state(struct device *dev, const char *state) -{ - return -ENODEV; -} - -static inline int pinctrl_select_state_default(struct device *dev) -{ - return -ENODEV; -} - -static inline int of_pinctrl_select_state(struct device_node *np, const char *state) -{ - return -ENODEV; -} - -static inline int of_pinctrl_select_state_default(struct device_node *np) -{ - return -ENODEV; -} - -static inline int pinctrl_gpio_direction_input(unsigned pin) -{ - return -ENOTSUPP; -} - -static inline int pinctrl_gpio_direction_output(unsigned int pin) -{ - return -ENOTSUPP; -} - -static inline int pinctrl_gpio_get_direction(unsigned pin) -{ - return -ENOTSUPP; -} - -static inline int pinctrl_single_probe(struct device *dev) -{ - return -ENOSYS; -} -#endif - #endif /* PINCTRL_H */ -- 2.39.2