aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-10-25 06:59:05 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-10-29 21:26:14 -0400
commit403c1d0be5ccbd750d25c59d8358843a81e52e3b (patch)
treeee0bafd365c5a3e16ab8fec02d89c94a584230f0 /include
parent3c2c628f82a2c48c0d684dbf63b6a4765e784444 (diff)
gpio: provide stubs for devres gpio functions
commit 6b3d8145dcfdbbb43f13544e16f44f4574f941dd "gpiolib: make GPIO_DEVRES depend on GPIOLIB" breaks builds when device drivers are using devm_gpio* devres functions without enabling GPIOLIB, relying on the devres code to be compiled anyway. Provide stubs so that we get these if we're using the devres functions without GPIOLIB. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Cc: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/gpio.h34
1 files changed, 27 insertions, 7 deletions
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index c691df044458..0c56b9e9c209 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -77,6 +77,15 @@ static inline int irq_to_gpio(unsigned int irq)
77 77
78#endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ 78#endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
79 79
80/* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */
81
82struct device;
83
84int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
85int devm_gpio_request_one(struct device *dev, unsigned gpio,
86 unsigned long flags, const char *label);
87void devm_gpio_free(struct device *dev, unsigned int gpio);
88
80#else /* ! CONFIG_GPIOLIB */ 89#else /* ! CONFIG_GPIOLIB */
81 90
82#include <linux/kernel.h> 91#include <linux/kernel.h>
@@ -241,14 +250,25 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip)
241 WARN_ON(1); 250 WARN_ON(1);
242} 251}
243 252
244#endif /* ! CONFIG_GPIOLIB */ 253static inline int devm_gpio_request(struct device *dev, unsigned gpio,
254 const char *label)
255{
256 WARN_ON(1);
257 return -EINVAL;
258}
245 259
246struct device; 260static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
261 unsigned long flags, const char *label)
262{
263 WARN_ON(1);
264 return -EINVAL;
265}
247 266
248/* bindings for managed devices that want to request gpios */ 267static inline void devm_gpio_free(struct device *dev, unsigned int gpio)
249int devm_gpio_request(struct device *dev, unsigned gpio, const char *label); 268{
250int devm_gpio_request_one(struct device *dev, unsigned gpio, 269 WARN_ON(1);
251 unsigned long flags, const char *label); 270}
252void devm_gpio_free(struct device *dev, unsigned int gpio); 271
272#endif /* ! CONFIG_GPIOLIB */
253 273
254#endif /* __LINUX_GPIO_H */ 274#endif /* __LINUX_GPIO_H */