[Pdbg] [PATCH 11/23] libpdbg: Probe should traverse all nodes

Amitay Isaacs amitay at ozlabs.org
Thu Sep 19 12:33:21 AEST 2019


This ensures a backend device tree traversal or a system device tree
(view) traversal, always return consistent result.

Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 libpdbg/target.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libpdbg/target.c b/libpdbg/target.c
index d550be8..52b6f95 100644
--- a/libpdbg/target.c
+++ b/libpdbg/target.c
@@ -426,6 +426,11 @@ enum pdbg_target_status pdbg_target_probe(struct pdbg_target *target)
 		}
 	}
 
+	/* Make sure any virtual parents are also probed */
+	if (target->compatible && target->vnode) {
+		pdbg_target_probe(target->vnode);
+	}
+
 	/* At this point any parents must exist and have already been probed */
 	if (target->probe && target->probe(target)) {
 		/* Could not find the target */
@@ -460,12 +465,12 @@ void pdbg_target_release(struct pdbg_target *target)
  */
 void pdbg_target_probe_all(struct pdbg_target *parent)
 {
-	struct pdbg_target *child;
+	struct pdbg_target *child = NULL;
 
 	if (!parent)
 		parent = pdbg_target_root();
 
-	pdbg_for_each_child_target(parent, child) {
+	list_for_each(&parent->children, child, list) {
 		pdbg_target_probe_all(child);
 		pdbg_target_probe(child);
 	}
-- 
2.21.0



More information about the Pdbg mailing list