[PATCH 4/8] devinfo: indicate if device tree nodes are differently populated
Ahmad Fatoum
a.fatoum at pengutronix.de
Sun Nov 26 22:35:55 PST 2023
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 at 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
More information about the barebox
mailing list