From aa99c2ee7e33ffe191fbb9780c6e219d8caa766d Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Mon, 21 Oct 2013 17:26:48 +0200 Subject: [PATCH] gpio: Fix build breakage Signed-off-by: Thierry Reding --- include/linux/gpio.h | 1 + include/linux/gpio/consumer.h | 74 +++++++++++++++++++++-------------- include/linux/gpio/driver.h | 1 + include/linux/of_gpio.h | 1 + 4 files changed, 47 insertions(+), 30 deletions(-) diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 7b92e0a235b4..40696d5afec3 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -87,6 +87,7 @@ static inline int irq_to_gpio(unsigned int irq) struct device; struct gpio_chip; +struct pinctrl_dev; static inline bool gpio_is_valid(int number) { diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 4d34dbbbad4d..e944c46d3228 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -26,13 +26,6 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, unsigned int idx); void gpiod_put(struct gpio_desc *desc); -struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, - const char *con_id); -struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, - const char *con_id, - unsigned int idx); -void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); - int gpiod_get_direction(const struct gpio_desc *desc); int gpiod_direction_input(struct gpio_desc *desc); int gpiod_direction_output(struct gpio_desc *desc, int value); @@ -68,33 +61,15 @@ static inline struct gpio_desc *__must_check gpiod_get(struct device *dev, { return ERR_PTR(-ENOSYS); } + static inline struct gpio_desc *__must_check gpiod_get_index(struct device *dev, const char *con_id, unsigned int idx) { return ERR_PTR(-ENOSYS); } -static inline void gpiod_put(struct gpio_desc *desc) -{ - might_sleep(); - - /* GPIO can never have been requested */ - WARN_ON(1); -} -static inline struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, - const char *con_id) -{ - return ERR_PTR(-ENOSYS); -} -static inline -struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, - const char *con_id, - unsigned int idx) -{ - return ERR_PTR(-ENOSYS); -} -static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) +static inline void gpiod_put(struct gpio_desc *desc) { might_sleep(); @@ -102,19 +77,20 @@ static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) WARN_ON(1); } - static inline int gpiod_get_direction(const struct gpio_desc *desc) { /* GPIO can never have been requested */ WARN_ON(1); return -ENOSYS; } + static inline int gpiod_direction_input(struct gpio_desc *desc) { /* GPIO can never have been requested */ WARN_ON(1); return -ENOSYS; } + static inline int gpiod_direction_output(struct gpio_desc *desc, int value) { /* GPIO can never have been requested */ @@ -122,24 +98,26 @@ static inline int gpiod_direction_output(struct gpio_desc *desc, int value) return -ENOSYS; } - static inline int gpiod_get_value(const struct gpio_desc *desc) { /* GPIO can never have been requested */ WARN_ON(1); return 0; } + static inline void gpiod_set_value(struct gpio_desc *desc, int value) { /* GPIO can never have been requested */ WARN_ON(1); } + static inline int gpiod_get_raw_value(const struct gpio_desc *desc) { /* GPIO can never have been requested */ WARN_ON(1); return 0; } + static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value) { /* GPIO can never have been requested */ @@ -152,17 +130,20 @@ static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc) WARN_ON(1); return 0; } + static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value) { /* GPIO can never have been requested */ WARN_ON(1); } + static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc) { /* GPIO can never have been requested */ WARN_ON(1); return 0; } + static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value) { @@ -183,6 +164,7 @@ static inline int gpiod_is_active_low(const struct gpio_desc *desc) WARN_ON(1); return 0; } + static inline int gpiod_cansleep(const struct gpio_desc *desc) { /* GPIO can never have been requested */ @@ -201,12 +183,14 @@ static inline struct gpio_desc *gpio_to_desc(unsigned gpio) { return ERR_PTR(-EINVAL); } + static inline int desc_to_gpio(const struct gpio_desc *desc) { /* GPIO can never have been requested */ WARN_ON(1); return -EINVAL; } + static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) { /* GPIO can never have been requested */ @@ -214,7 +198,6 @@ static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) return ERR_PTR(-ENODEV); } - #endif /* CONFIG_GPIOLIB */ #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) @@ -250,4 +233,35 @@ static inline void gpiod_unexport(struct gpio_desc *desc) #endif /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ +#ifdef CONFIG_GPIO_DEVRES +struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, + const char *con_id); +struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, + const char *con_id, + unsigned int idx); +void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); +#else +static inline struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, + const char *con_id) +{ + return ERR_PTR(-ENOSYS); +} + +static inline +struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, + const char *con_id, + unsigned int idx) +{ + return ERR_PTR(-ENOSYS); +} + +static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) +{ + might_sleep(); + + /* GPIO can never have been requested */ + WARN_ON(1); +} +#endif + #endif diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index cd9da3885d79..656a27efb2c8 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -5,6 +5,7 @@ struct device; struct gpio_desc; +struct seq_file; /** * struct gpio_chip - abstract a GPIO controller diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index d71f2cc141ae..2c98e76e286f 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h @@ -18,6 +18,7 @@ #include #include #include +#include #include struct device_node; -- 2.39.2