aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2019-08-19 11:30:58 +0200
committerLinus Walleij <linus.walleij@linaro.org>2019-08-20 10:42:07 +0200
commiteb1e8bd6e3900e3a3b9776cd1b09ecfc05573619 (patch)
treeae5a6cb3d886b6996863b19b9ada95fc0358e273 /drivers/gpio
parentpinctrl: stmfx: Use the callback to populate valid_mask (diff)
downloadlinux-dev-eb1e8bd6e3900e3a3b9776cd1b09ecfc05573619.tar.xz
linux-dev-eb1e8bd6e3900e3a3b9776cd1b09ecfc05573619.zip
gpio: Use callback presence to determine need of valid_mask
After we switched the two drivers that have .need_valid_mask set to use the callback for setting up the .valid_mask, we can just use the presence of the .init_valid_mask() callback (or the OF reserved ranges, nota bene) to determine whether to allocate the mask or not and we can drop the .need_valid_mask field altogether. Cc: Benjamin Gaignard <benjamin.gaignard@st.com> Cc: Amelie Delaunay <amelie.delaunay@st.com> Cc: Stephen Boyd <swboyd@chromium.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20190819093058.10863-1-linus.walleij@linaro.org
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 22b87c6e8cd5..01aa5440454c 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -363,9 +363,7 @@ static unsigned long *gpiochip_allocate_mask(struct gpio_chip *chip)
static int gpiochip_alloc_valid_mask(struct gpio_chip *gc)
{
- if (of_gpio_need_valid_mask(gc))
- gc->need_valid_mask = true;
- if (!gc->need_valid_mask)
+ if (!(of_gpio_need_valid_mask(gc) || gc->init_valid_mask))
return 0;
gc->valid_mask = gpiochip_allocate_mask(gc);