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 4/8] devinfo: indicate if device tree nodes are differently populated
Date: Mon, 27 Nov 2023 07:35:55 +0100	[thread overview]
Message-ID: <20231127063559.2205776-5-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20231127063559.2205776-1-a.fatoum@pengutronix.de>

We don't preclude multiple devices pointing at the same device tree
node. It would be useful information for the user to indicate when
that's the case, so extend devinfo to show the information.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/devinfo.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/commands/devinfo.c b/commands/devinfo.c
index d89d8c2f0ac4..aeb9c5533931 100644
--- a/commands/devinfo.c
+++ b/commands/devinfo.c
@@ -103,8 +103,17 @@ static int do_devinfo(int argc, char *argv[])
 		}
 #ifdef CONFIG_OFDEVICE
 		if (dev->of_node) {
-			printf("Device node: %pOF\n", dev->of_node);
-			of_print_nodes(dev->of_node, 0, ~0);
+			struct device *main_dev = dev->of_node->dev;
+
+			printf("Device node: %pOF", dev->of_node);
+			if (!main_dev) {
+			       printf(" (unpopulated)\n");
+			} else if (main_dev != dev) {
+			       printf(" (populated by %s)\n", dev_name(main_dev));
+			} else {
+				printf("\n");
+				of_print_nodes(dev->of_node, 0, ~0);
+			}
 		}
 #endif
 	}
-- 
2.39.2




  parent reply	other threads:[~2023-11-27  6:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27  6:35 [PATCH 0/8] optee: add bidirectional communication support Ahmad Fatoum
2023-11-27  6:35 ` [PATCH 1/8] driver: don't clear unrelated struct device_node::device on unregister Ahmad Fatoum
2023-11-27  6:35 ` [PATCH 2/8] deep-probe: don't panic when device can't be created Ahmad Fatoum
2023-11-27  6:35 ` [PATCH 3/8] deep-probe: skip on-demand platform dev creation for nodes without compatible Ahmad Fatoum
2023-11-29  9:12   ` Sascha Hauer
2023-11-30  8:02     ` Ahmad Fatoum
2023-11-27  6:35 ` Ahmad Fatoum [this message]
2023-11-27  6:35 ` [PATCH 5/8] include: uaccess.h: import from linux Ahmad Fatoum
2023-11-27  6:35 ` [PATCH 6/8] optee: add bidirectional communication support Ahmad Fatoum
2023-11-27  6:35 ` [PATCH 7/8] optee: add experimental support for /dev/tee0 Ahmad Fatoum
2023-11-27  6:35 ` [PATCH 8/8] hw_random: add implementation for OP-TEE RNG pseudo TA Ahmad Fatoum
2023-12-01 10:39 ` [PATCH 0/8] optee: add bidirectional communication support Sascha Hauer

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=20231127063559.2205776-5-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