Skip to content

Commit

Permalink
gpio: Support GPIO controllers without pin-ranges
Browse files Browse the repository at this point in the history
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 <treding@nvidia.com>
Link: https://lore.kernel.org/r/20200319122737.3063291-2-thierry.reding@gmail.com
Tested-by: Vidya Sagar <vidyas@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
thierryreding authored and linusw committed Mar 27, 2020
1 parent da3f594 commit 2ab73c6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2ab73c6

Please sign in to comment.