Subject: Re: [PATCH v2 3/4] ARM: pxa: pxa25x: attach software node to its target GPIO controller

From: "Russell King (Oracle)" <[email-masked]>
Date: Mon, 27 Apr 2026 11:58:15 +0100

On Mon, Apr 27, 2026 at 12:14:34PM +0200, Bartosz Golaszewski wrote:
> Software node describing the GPIO controller for the pxa25x platforms is
> currently "dangling" - it's not actually attached to the relevant
> controller and doesn't allow real fwnode lookup. Attach it once it's
> registered as a firmware node before adding the platform device.
> 
> Reviewed-by: Linus Walleij <[email-masked]>
> Signed-off-by: Bartosz Golaszewski <[email-masked]>
> ---
>  arch/arm/mach-pxa/pxa25x.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
> index 70509a5998142ec6b9c484e5f094751eda6db6cd..6875774f2cae1db4798d18c813f445bdc31b15de 100644
> --- a/arch/arm/mach-pxa/pxa25x.c
> +++ b/arch/arm/mach-pxa/pxa25x.c
> @@ -179,7 +179,6 @@ void __init pxa25x_map_io(void)
>  }
>  
>  static struct platform_device *pxa25x_devices[] __initdata = {
> -	&pxa25x_device_gpio,
>  	&pxa25x_device_udc,
>  	&pxa_device_pmu,
>  	&pxa_device_i2s,
> @@ -240,6 +239,10 @@ static int __init pxa25x_init(void)
>  
>  		if (!of_have_populated_dt()) {
>  			software_node_register(&pxa2xx_gpiochip_node);
> +			pxa25x_device_gpio.dev.fwnode = software_node_fwnode(
> +								&pxa2xx_gpiochip_node);
> +			platform_device_register(&pxa25x_device_gpio);
> +
>  			pxa2xx_set_dmac_info(&pxa25x_dma_pdata);
>  			ret = platform_add_devices(pxa25x_devices,
>  						   ARRAY_SIZE(pxa25x_devices));

Why do you need to explicitly register using platform_device_register()
rather than leaving the device in the pxa25x_devices list and letting
platform_add_devices() do that for you? platform_add_devices() is just
a wrapper around platform_device_register() which calls that for all
devices in the array.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!