Skip to contentSkip to conversation

gpio: ixp4xx: switch to dynamic GPIO base

PATCH Applied Mohamed Ayman 3 participants 3 messages Apr 27 – Apr 28

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: ixp4xx: switch to dynamic GPIO base

Most IXP4xx platforms are Device Tree-based, and GPIO consumers use phandle-based descriptors rather than legacy integer GPIO numbers.

Audit of the IXP4xx platform shows:
- No gpio_request(), gpio_get_value(), or gpio_set_value() users in arch/arm/mach-ixp4xx/
- No platform data using fixed GPIO numbers

This switches the gpiochip to dynamic base allocation, aligning with modern gpiolib expectations where GPIO numbers are not globally fixed and may be assigned dynamically.

Set gpiochip.base = -1 to allow gpiolib to assign the GPIO base dynamically, avoiding global GPIO number space conflicts.

---
 drivers/gpio/gpio-ixp4xx.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpio/gpio-ixp4xx.c +1 -6
index f34d87869c8b..669b139cd499 100644
@@ -311,12 +311,7 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev)
 	}
 	g->chip.gc.ngpio = 16;
 	g->chip.gc.label = "IXP4XX_GPIO_CHIP";
-	/*
-	 * TODO: when we have migrated to device tree and all GPIOs
-	 * are fetched using phandles, set this to -1 to get rid of
-	 * the fixed gpiochip base.
-	 */
-	g->chip.gc.base = 0;
+	g->chip.gc.base = -1;
 	g->chip.gc.parent = &pdev->dev;
 	g->chip.gc.owner = THIS_MODULE;
 
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Mohamed Ayman

Most IXP4xx platforms are Device Tree-based, and GPIO consumers use phandle-based descriptors rather than legacy integer GPIO numbers.

Audit of the IXP4xx platform shows:
- No gpio_request(), gpio_get_value(), or gpio_set_value() users in arch/arm/mach-ixp4xx/
- No platform data using fixed GPIO numbers

Quoted 8 lines

This switches the gpiochip to dynamic base allocation, aligning with modern gpiolib expectations where GPIO numbers are not globally fixed and may be assigned dynamically.

Set gpiochip.base = -1 to allow gpiolib to assign the GPIO base dynamically, avoiding global GPIO number space conflicts.

You're right and you beat me to it! No-one is dependent on the fixed GPIO numbering for this platform.

Yours,
Linus Walleij

#2 lore raw
In reply to Mohamed Ayman
Quoted 9 lines · Mohamed Ayman

Most IXP4xx platforms are Device Tree-based, and GPIO consumers use phandle-based descriptors rather than legacy integer GPIO numbers.

Audit of the IXP4xx platform shows:
- No gpio_request(), gpio_get_value(), or gpio_set_value() users in arch/arm/mach-ixp4xx/
- No platform data using fixed GPIO numbers

[...]

Applied, thanks!

[1/1] gpio: ixp4xx: switch to dynamic GPIO base

      https://git.kernel.org/brgl/c/1005d6e0257a5623ef79bfbd8f588b498c1cab0d

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>