aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <[email protected]>2020-03-19 13:27:29 +0100
committerLinus Walleij <[email protected]>2020-03-27 11:34:53 +0100
commit2ab73c6d8323fa1eb02c16c07c40ba2ed17da729 (patch)
tree63248ef39eecb4f2ddb7bb8ad7607fcb3747bcec
parentda3f594737cfa24c44769ff17ce2643f85eb0ef5 (diff)
gpio: Support GPIO controllers without pin-ranges
Wake gpiochip_generic_request() call into the pinctrl helpers only if a GPIO controller had any pin-ranges assigned to it. This allows a driver to unconditionally use this helper if it supports multiple devices of which only a subset have pin-ranges assigned to them. Signed-off-by: Thierry Reding <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Vidya Sagar <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
-rw-r--r--drivers/gpio/gpiolib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index c7ee224bcb86..4a36164843d9 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2745,7 +2745,10 @@ static inline void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip)
*/
int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset)
{
- return pinctrl_gpio_request(chip->gpiodev->base + offset);
+ if (!list_empty(&chip->gpiodev->pin_ranges))
+ return pinctrl_gpio_request(chip->gpiodev->base + offset);
+
+ return 0;
}
EXPORT_SYMBOL_GPL(gpiochip_generic_request);