From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device
Date: Mon, 20 Oct 2025 14:46:56 +0200 [thread overview]
Message-ID: <0f128caf-738f-42df-98f9-91dcbd2a17d4@pengutronix.de> (raw)
In-Reply-To: <aPYTVLV88jhpRc24@pengutronix.de>
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 |
prev parent reply other threads:[~2025-10-20 12:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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
2025-10-20 12:46 ` Ahmad Fatoum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0f128caf-738f-42df-98f9-91dcbd2a17d4@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox