[PATCH] of: of_probe: create board's machine device at the earliest

Sascha Hauer sha at pengutronix.de
Tue Sep 13 01:27:55 PDT 2022


On Mon, Sep 05, 2022 at 09:02:08AM +0200, Ahmad Fatoum wrote:
> We currently create devices for matching reserved memory entries and
> firmware before creating the machine device. In a deep probe system, the
> machine driver would be probed directly at registration and as such
> needs to be probed before other devices are created, so it can disable
> other devices if needed. Move the machine device registration to the
> top, so board drivers can disabled reserved memory entries and firmware
> if they need to.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  drivers/of/base.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 52e6a9294e11..6a51dd71793d 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -2503,6 +2503,12 @@ int of_probe(void)
>  	if(!root_node)
>  		return -ENODEV;
>  
> +	/*
> +	 * We do this first thing, so board drivers can patch the device
> +	 * tree prior to device creation if needed.
> +	 */
> +	of_platform_device_create_root(root_node);
> +
>  	/*
>  	 * Handle certain compatibles explicitly, since we don't want to create
>  	 * platform_devices for every node in /reserved-memory with a
> @@ -2515,8 +2521,6 @@ int of_probe(void)
>  	if (node)
>  		of_platform_populate(node, NULL, NULL);
>  
> -	of_platform_device_create_root(root_node);
> -
>  	of_platform_populate(root_node, of_default_bus_match_table, NULL);
>  
>  	return 0;
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list