gpiolib: add devm_gpiod_get_array and devm_gpiod_put_array functions

Add device managed variants of gpiod_get_array() / gpiod_put_array()
functions for conveniently obtaining and disposing of an entire array
of GPIOs with one function call.

Signed-off-by: Rojhalat Ibrahim <[email protected]>
Reviewed-by: Alexandre Courbot <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
Rojhalat Ibrahim 2015-02-11 17:28:02 +01:00 • committed by Linus Walleij
commit 331758eef8
3 changed files with 131 additions and 2 deletions

View file

@ -102,11 +102,19 @@ Device-managed variants of these functions are also defined:
const char *con_id,
enum gpiod_flags flags)
struct gpio_desc * devm_gpiod_get_index_optional(struct device *dev,
struct gpio_desc *devm_gpiod_get_index_optional(struct device *dev,
const char *con_id,
unsigned int index,
enum gpiod_flags flags)
struct gpio_descs *devm_gpiod_get_array(struct device *dev,
const char *con_id,
enum gpiod_flags flags)
struct gpio_descs *devm_gpiod_get_array_optional(struct device *dev,
const char *con_id,
enum gpiod_flags flags)
A GPIO descriptor can be disposed of using the gpiod_put() function:
void gpiod_put(struct gpio_desc *desc)
@ -119,10 +127,12 @@ It is strictly forbidden to use a descriptor after calling these functions.
It is also not allowed to individually release descriptors (using gpiod_put())
from an array acquired with gpiod_get_array().
The device-managed variant is, unsurprisingly:
The device-managed variants are, unsurprisingly:
void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
void devm_gpiod_put_array(struct device *dev, struct gpio_descs *descs)
Using GPIOs
===========