diff options
| author | Alistair Popple <alistair@popple.id.au> | 2018-10-25 16:42:15 +1100 |
|---|---|---|
| committer | Alistair Popple <alistair@popple.id.au> | 2018-11-09 11:27:54 +1100 |
| commit | cf249e7912069d6fece97e575ce3bae7365f8677 (patch) | |
| tree | 407cc9ab8ec550ba4090eb1b7b58d0232fb5ce9c | |
| parent | 82bd8aefa25318c03a269f6863142525010260e4 (diff) | |
| download | pdbg-cf249e7912069d6fece97e575ce3bae7365f8677.tar.gz pdbg-cf249e7912069d6fece97e575ce3bae7365f8677.zip | |
libpdbg: Make dt_root private
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
| -rw-r--r-- | libpdbg/device.c | 13 | ||||
| -rw-r--r-- | libpdbg/device.h | 2 | ||||
| -rw-r--r-- | libpdbg/target.c | 9 | ||||
| -rw-r--r-- | src/main.c | 2 |
4 files changed, 12 insertions, 14 deletions
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; +} diff --git a/libpdbg/device.h b/libpdbg/device.h index 92d7da3..4a4a06f 100644 --- a/libpdbg/device.h +++ b/libpdbg/device.h @@ -23,6 +23,4 @@ /* Any property or node with this prefix will not be passed to the kernel. */ #define DT_PRIVATE "skiboot," -extern struct pdbg_target *dt_root; - #endif /* __DEVICE_H */ diff --git a/libpdbg/target.c b/libpdbg/target.c index 5599d78..5ebe71d 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -31,7 +31,7 @@ static struct pdbg_target *get_class_target_addr(struct pdbg_target *target, con /* The root node doesn't have an address space so it's * an error in the device tree if we hit this. */ - assert(target != dt_root); + assert(target != pdbg_target_root()); } return target; @@ -365,7 +365,7 @@ void pdbg_target_probe_all(struct pdbg_target *parent) struct pdbg_target *child; if (!parent) - parent = dt_root; + parent = pdbg_target_root(); pdbg_for_each_child_target(parent, child) { pdbg_target_probe_all(child); @@ -389,8 +389,3 @@ void pdbg_target_priv_set(struct pdbg_target *target, void *priv) { target->priv = priv; } - -struct pdbg_target *pdbg_target_root(void) -{ - return dt_root; -} @@ -791,7 +791,7 @@ OPTCMD_DEFINE_CMD(probe, probe); */ static void atexit_release(void) { - pdbg_target_release(dt_root); + pdbg_target_release(pdbg_target_root()); } int main(int argc, char *argv[]) |

