From cf249e7912069d6fece97e575ce3bae7365f8677 Mon Sep 17 00:00:00 2001 From: Alistair Popple Date: Thu, 25 Oct 2018 16:42:15 +1100 Subject: libpdbg: Make dt_root private Signed-off-by: Alistair Popple Reviewed-by: Amitay Isaacs --- libpdbg/device.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'libpdbg/device.c') diff --git a/libpdbg/device.c b/libpdbg/device.c index 7e8af35..4a9d39a 100644 --- a/libpdbg/device.c +++ b/libpdbg/device.c @@ -36,7 +36,7 @@ /* Used to give unique handles. */ static u32 last_phandle = 0; -struct pdbg_target *dt_root; +static struct pdbg_target *pdbg_dt_root; /* * An in-memory representation of a node in the device tree. @@ -591,7 +591,7 @@ static void dt_expand(const void *fdt) { PR_DEBUG("FDT: Parsing fdt @%p\n", fdt); - if (dt_expand_node(dt_root, fdt, 0) < 0) + if (dt_expand_node(pdbg_dt_root, fdt, 0) < 0) abort(); } @@ -637,7 +637,7 @@ uint64_t pdbg_target_address(struct pdbg_target *target, uint64_t *out_size) void pdbg_targets_init(void *fdt) { - dt_root = dt_new_node("", NULL, 0); + pdbg_dt_root = dt_new_node("", NULL, 0); dt_expand(fdt); } @@ -649,7 +649,12 @@ char *pdbg_target_path(const struct pdbg_target *target) struct pdbg_target *pdbg_target_from_path(struct pdbg_target *target, const char *path) { if (!target) - target = dt_root; + target = pdbg_dt_root; return dt_find_by_path(target, path); } + +struct pdbg_target *pdbg_target_root(void) +{ + return pdbg_dt_root; +} -- cgit v1.2.1