On Wed, Oct 15, 2025 at 11:27:01AM +0200, Ahmad Fatoum wrote:
> There is a log message when deep probe is disabled, but to make it
> easier to verify that it's enabled, let's introduce it as extra info
> in the devinfo command.
> 
> Signed-off-by: Ahmad Fatoum <[email protected]>
> ---
>  commands/devinfo.c |  4 ++++
>  drivers/of/base.c  | 12 +++++++++---
>  include/of.h       |  2 ++
>  3 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/commands/devinfo.c b/commands/devinfo.c
> index cff4dbb92e31..e132f88bf3f3 100644
> --- a/commands/devinfo.c
> +++ b/commands/devinfo.c
> @@ -117,6 +117,10 @@ static int do_devinfo(int argc, char *argv[])
>                               printf("\n");
>                               of_print_nodes(dev->of_node, 0, ~0);
>                       }
> +
> +                     if (dev == of_platform_root_device)

Can't this just be

                        if (dev->of_node && !dev->of_node->parent)

?

Sascha

> +                             printf("Deep probe: %s\n",
> +                                    deep_probe_is_supported() ? "true" : 
> "false");
>               }
>  #endif
>       }
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index c20fffb899a9..15265dc22623 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -2909,12 +2909,14 @@ static int of_probe_memory(void)
>  }
>  mem_initcall(of_probe_memory);
>  
> +struct device *of_platform_root_device;
> +
>  static void of_platform_device_create_root(struct device_node *np)
>  {
> -     static struct device *dev;
> +     struct device *dev;
>       int ret;
>  
> -     if (dev)
> +     if (of_platform_root_device)
>               return;
>  
>       dev = xzalloc(sizeof(*dev));
> @@ -2923,8 +2925,12 @@ static void of_platform_device_create_root(struct 
> device_node *np)
>       dev_set_name(dev, "machine");
>  
>       ret = platform_device_register(dev);
> -     if (ret)
> +     if (WARN_ON(ret)) {
>               free_device(dev);
> +             return;
> +     }
> +
> +     of_platform_root_device = dev;
>  }
>  
>  static const struct of_device_id reserved_mem_matches[] = {
> diff --git a/include/of.h b/include/of.h
> index 640d76f4aade..d1efab13c780 100644
> --- a/include/of.h
> +++ b/include/of.h
> @@ -428,6 +428,8 @@ extern int of_set_root_node(struct device_node *node);
>  extern int barebox_register_of(struct device_node *root);
>  extern int barebox_register_fdt(const void *dtb);
>  
> +extern struct device *of_platform_root_device;
> +
>  extern struct device *of_platform_device_create(struct device_node *np,
>                                               struct device *parent);
>  extern void of_platform_device_dummy_drv(struct device *dev);
> -- 
> 2.47.3
> 
> 
> 

-- 
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 |

Reply via email to