Skip to contentSkip to conversation

gpio: Avoid using pin ranges with !PINCTRL

PATCH In review Thierry Reding 3 participants 4 messages Mar 30, 2020 – Mar 31, 2020 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: Avoid using pin ranges with !PINCTRL

From: Thierry Reding <[email protected]>

Do not use the struct gpio_device's .pin_ranges field if the PINCTRL Kconfig symbol is not selected to avoid build failures.

Fixes d2fbe53a806e ("gpio: Support GPIO controllers without pin-ranges")
---
 drivers/gpio/gpiolib.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpio/gpiolib.c +5 -3
index e6f9def09f55..5c245883c9c5 100644
@@ -2753,10 +2753,12 @@ static inline void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip)
  */
 int gpiochip_generic_request(struct gpio_chip *chip, unsigned offset)
 {
-	if (!list_empty(&chip->gpiodev->pin_ranges))
-		return pinctrl_gpio_request(chip->gpiodev->base + offset);
+#ifdef CONFIG_PINCTRL
+	if (list_empty(&chip->gpiodev->pin_ranges))
+		return 0;
+#endif
 
-	return 0;
+	return pinctrl_gpio_request(chip->gpiodev->base + offset);
 }
 EXPORT_SYMBOL_GPL(gpiochip_generic_request);
 
Signature · 1 line
2.24.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw

Hi Thierry,

Thanks for your patch!

Quoted 6 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Do not use the struct gpio_device's .pin_ranges field if the PINCTRL Kconfig symbol is not selected to avoid build failures.

Fixes d2fbe53a806e ("gpio: Support GPIO controllers without pin-ranges")

WARNING: Unknown commit id 'd2fbe53a806e', maybe rebased or not pulled?

Fixes 2ab73c6d8323fa1e ("gpio: Support GPIO controllers without pin-ranges")
Quoted 3 lines

With the above fixed:

This fixes the build (and boot) for rbtx4927, so:

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw
Quoted 8 lines · Geert Uytterhoeven

Hi Thierry,

Thanks for your patch!

Quoted 2 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Quoted 8 lines
Quoted 4 lines

Do not use the struct gpio_device's .pin_ranges field if the PINCTRL Kconfig symbol is not selected to avoid build failures.

Fixes d2fbe53a806e ("gpio: Support GPIO controllers without pin-ranges")

WARNING: Unknown commit id 'd2fbe53a806e', maybe rebased or not pulled?

Fixes 2ab73c6d8323fa1e ("gpio: Support GPIO controllers without pin-ranges")

Yeah, it looks like I made this patch on top of my local tree but forgot to rebase on the latest linux-next.

Thierry

#3 lore raw
In reply to Thierry Reding
Quoted 9 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Do not use the struct gpio_device's .pin_ranges field if the PINCTRL Kconfig symbol is not selected to avoid build failures.

Fixes d2fbe53a806e ("gpio: Support GPIO controllers without pin-ranges")

Patch applied with Geert's tags and fixes.

Yours,
Linus Walleij