mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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:
parent
6685852732
commit
331758eef8
3 changed files with 131 additions and 2 deletions
|
|
@ -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
|
||||
===========
|
||||
|
|
|
|||
Loading…
Reference in a new issue