diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2018-10-05 09:52:58 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-10-10 11:31:40 +0300 |
commit | f8ec92a9f63b3b11e399409141b7868bb405e6b5 (patch) | |
tree | d1771589a157dc6bf83d67364a7c5dd64f8f1d69 /include/linux/gpio | |
parent | 2505c7b0128f63289a59d77ee39cacd08aacf779 (diff) | |
download | linux-f8ec92a9f63b3b11e399409141b7868bb405e6b5.tar.xz |
gpiolib: Add init_valid_mask exported function
Add a function that allows initializing the valid_mask from
gpiochip_add_data.
This prevents race conditions during gpiochip initialization.
If the function is not exported, then the old behaviour is respected,
this is, set all gpios as valid.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Tested-by: Jeffrey Hugo <jhugo@codeaurora.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/gpio')
-rw-r--r-- | include/linux/gpio/driver.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index f6b95734073f..c5a51af8f76e 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -280,6 +280,9 @@ struct gpio_chip { void (*dbg_show)(struct seq_file *s, struct gpio_chip *chip); + + int (*init_valid_mask)(struct gpio_chip *chip); + int base; u16 ngpio; const char *const *names; @@ -318,7 +321,9 @@ struct gpio_chip { /** * @need_valid_mask: * - * If set core allocates @valid_mask with all bits set to one. + * If set core allocates @valid_mask with all its values initialized + * with init_valid_mask() or set to one if init_valid_mask() is not + * defined */ bool need_valid_mask; |