[Pdbg] [PATCH v5 22/30] libpdbg: Pass root node to dt_expand
Amitay Isaacs
amitay at ozlabs.org
Mon Oct 14 16:17:40 AEDT 2019
This will enable parsing more than one device tree.
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
Reviewed-by: Alistair Popple <alistair at popple.id.au>
---
libpdbg/device.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libpdbg/device.c b/libpdbg/device.c
index f357e99..ef09019 100644
--- a/libpdbg/device.c
+++ b/libpdbg/device.c
@@ -604,7 +604,7 @@ static int dt_expand_node(struct pdbg_target *node, const void *fdt, int fdt_nod
return nextoffset;
}
-static void dt_expand(void *root, const void *fdt)
+static void dt_expand(struct pdbg_target *root, const void *fdt)
{
PR_DEBUG("FDT: Parsing fdt @%p\n", fdt);
@@ -749,9 +749,6 @@ skip:
void pdbg_targets_init(void *fdt)
{
- /* Root node needs to be valid when this function returns */
- pdbg_dt_root = dt_new_node("", NULL, 0);
-
if (!fdt)
fdt = pdbg_default_dtb();
@@ -760,7 +757,12 @@ void pdbg_targets_init(void *fdt)
return;
}
+ /* Root node needs to be valid when this function returns */
+ pdbg_dt_root = dt_new_node("", NULL, 0);
+ assert(pdbg_dt_root);
+
dt_expand(pdbg_dt_root, fdt);
+
pdbg_targets_init_virtual(pdbg_dt_root, pdbg_dt_root);
}
--
2.21.0
More information about the Pdbg
mailing list