* [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device @ 2025-10-15 9:27 Ahmad Fatoum 2025-10-15 9:27 ` [PATCH 2/2] devinfo: print / as device tree node for the root node Ahmad Fatoum 2025-10-20 10:47 ` [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device Sascha Hauer 0 siblings, 2 replies; 4+ messages in thread From: Ahmad Fatoum @ 2025-10-15 9:27 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum 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 <a.fatoum@pengutronix.de> --- 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) + 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] devinfo: print / as device tree node for the root node 2025-10-15 9:27 [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device Ahmad Fatoum @ 2025-10-15 9:27 ` Ahmad Fatoum 2025-10-20 10:47 ` [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device Sascha Hauer 1 sibling, 0 replies; 4+ messages in thread From: Ahmad Fatoum @ 2025-10-15 9:27 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum The root node has an empty name and thus %pOF returns an empty string. This is confusing for the machine device, so print just a / in that case. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- commands/devinfo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/devinfo.c b/commands/devinfo.c index e132f88bf3f3..c87b30e84307 100644 --- a/commands/devinfo.c +++ b/commands/devinfo.c @@ -108,7 +108,11 @@ static int do_devinfo(int argc, char *argv[]) dev_is_dma_coherent(dev) ? "true" : "false", dev->dma_coherent == DEV_DMA_COHERENCE_DEFAULT ? " (default)" : ""); - printf("Device node: %pOF", dev->of_node); + if (dev->of_node->parent) + printf("Device node: %pOF", dev->of_node); + else + printf("Device node: %s", "/"); + if (!main_dev) { printf(" (unpopulated)\n"); } else if (main_dev != dev) { -- 2.47.3 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device 2025-10-15 9:27 [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device Ahmad Fatoum 2025-10-15 9:27 ` [PATCH 2/2] devinfo: print / as device tree node for the root node Ahmad Fatoum @ 2025-10-20 10:47 ` Sascha Hauer 2025-10-20 12:46 ` Ahmad Fatoum 1 sibling, 1 reply; 4+ messages in thread From: Sascha Hauer @ 2025-10-20 10:47 UTC (permalink / raw) To: Ahmad Fatoum; +Cc: barebox 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 <a.fatoum@pengutronix.de> > --- > 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 | ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device 2025-10-20 10:47 ` [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device Sascha Hauer @ 2025-10-20 12:46 ` Ahmad Fatoum 0 siblings, 0 replies; 4+ messages in thread From: Ahmad Fatoum @ 2025-10-20 12:46 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox Hello Sascha, On 10/20/25 12:47 PM, Sascha Hauer wrote: > 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 <a.fatoum@pengutronix.de> >> --- >> 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) > > ? No, some devices have a device tree node that's not rooted to the barebox live tree, e.g. TLVs have: dev->device_node = of_new_node(of_new_node(NULL, NULL), dev_name(dev)); Cheers, Ahmad > > 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 | ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-20 12:58 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-10-15 9:27 [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device Ahmad Fatoum 2025-10-15 9:27 ` [PATCH 2/2] devinfo: print / as device tree node for the root node Ahmad Fatoum 2025-10-20 10:47 ` [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device Sascha Hauer 2025-10-20 12:46 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox