summaryrefslogtreecommitdiffstats
path: root/include/linux/gpio/consumer.h
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2013-10-17 10:21:38 -0700
committerLinus Walleij <linus.walleij@linaro.org>2013-10-19 23:24:56 +0200
commitbae48da237fcedd7ad09569025483b988635efb7 (patch)
tree51d82d78acc5e248623dd73d9e5deb2ce4f0e869 /include/linux/gpio/consumer.h
parentaf8b6375a8291fe2cf77707f3edec86b98a999cc (diff)
downloadop-kernel-dev-bae48da237fcedd7ad09569025483b988635efb7.zip
op-kernel-dev-bae48da237fcedd7ad09569025483b988635efb7.tar.gz
gpiolib: add gpiod_get() and gpiod_put() functions
Add gpiod_get(), gpiod_get_index() and gpiod_put() functions that provide safer management of GPIOs. These functions put the GPIO framework in line with the conventions of other frameworks in the kernel, and help ensure every GPIO is declared properly and valid while it is used. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/gpio/consumer.h')
-rw-r--r--include/linux/gpio/consumer.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 2088eb5..4d34dbb 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -18,6 +18,21 @@ struct gpio_chip;
*/
struct gpio_desc;
+/* Acquire and dispose GPIOs */
+struct gpio_desc *__must_check gpiod_get(struct device *dev,
+ const char *con_id);
+struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
+ const char *con_id,
+ 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);
OpenPOWER on IntegriCloud