summaryrefslogtreecommitdiffstats
path: root/include/linux/gpio.h
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-10-25 12:59:05 +0200
committerLinus Walleij <linus.walleij@linaro.org>2013-10-29 18:26:14 -0700
commit403c1d0be5ccbd750d25c59d8358843a81e52e3b (patch)
treeee0bafd365c5a3e16ab8fec02d89c94a584230f0 /include/linux/gpio.h
parent3c2c628f82a2c48c0d684dbf63b6a4765e784444 (diff)
downloadop-kernel-dev-403c1d0be5ccbd750d25c59d8358843a81e52e3b.zip
op-kernel-dev-403c1d0be5ccbd750d25c59d8358843a81e52e3b.tar.gz
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/linux/gpio.h')
-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 c691df0..0c56b9e 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -77,6 +77,15 @@ static inline int irq_to_gpio(unsigned int irq)
#endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
+/* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */
+
+struct device;
+
+int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
+int devm_gpio_request_one(struct device *dev, unsigned gpio,
+ unsigned long flags, const char *label);
+void devm_gpio_free(struct device *dev, unsigned int gpio);
+
#else /* ! CONFIG_GPIOLIB */
#include <linux/kernel.h>
@@ -241,14 +250,25 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip)
WARN_ON(1);
}
-#endif /* ! CONFIG_GPIOLIB */
+static inline int devm_gpio_request(struct device *dev, unsigned gpio,
+ const char *label)
+{
+ WARN_ON(1);
+ return -EINVAL;
+}
-struct device;
+static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
+ unsigned long flags, const char *label)
+{
+ WARN_ON(1);
+ return -EINVAL;
+}
-/* bindings for managed devices that want to request gpios */
-int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
-int devm_gpio_request_one(struct device *dev, unsigned gpio,
- unsigned long flags, const char *label);
-void devm_gpio_free(struct device *dev, unsigned int gpio);
+static inline void devm_gpio_free(struct device *dev, unsigned int gpio)
+{
+ WARN_ON(1);
+}
+
+#endif /* ! CONFIG_GPIOLIB */
#endif /* __LINUX_GPIO_H */
OpenPOWER on IntegriCloud