mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/2] commands: devinfo: print Deep Probe status for top-level machine device
Date: Wed, 15 Oct 2025 11:27:01 +0200	[thread overview]
Message-ID: <20251015092706.2358673-1-a.fatoum@pengutronix.de> (raw)

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




             reply	other threads:[~2025-10-15  9:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15  9:27 Ahmad Fatoum [this message]
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

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=20251015092706.2358673-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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