[Pdbg] [PATCH 3/5] libpdbg: Rename dt_new_root to dt_new_node

Amitay Isaacs amitay at ozlabs.org
Thu Aug 16 15:57:54 AEST 2018


dt_new_root is not really creating a new root node.  It's just creating
a new node that is not attached to the tree.

Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 libpdbg/device.c | 9 ++-------
 libpdbg/device.h | 4 ++--
 libpdbg/target.c | 2 +-
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/libpdbg/device.c b/libpdbg/device.c
index e5b78f4..7442e29 100644
--- a/libpdbg/device.c
+++ b/libpdbg/device.c
@@ -51,7 +51,7 @@ static void free_name(const char *name)
 		free((char *)name);
 }
 
-static struct pdbg_target *new_node(const char *name, const void *fdt, int node_offset)
+struct pdbg_target *dt_new_node(const char *name, const void *fdt, int node_offset)
 {
 	struct hw_unit_info *hw_info = NULL;
 	const struct fdt_property *prop;
@@ -108,11 +108,6 @@ static struct pdbg_target *new_node(const char *name, const void *fdt, int node_
 	return node;
 }
 
-struct pdbg_target *dt_new_root(const char *name, const void *fdt, int offset)
-{
-	return new_node(name, fdt, offset);
-}
-
 static const char *get_unitname(const struct pdbg_target *node)
 {
 	const char *c = strchr(node->dn_name, '@');
@@ -771,7 +766,7 @@ int dt_expand_node(struct pdbg_target *node, const void *fdt, int fdt_node)
 			break;
 		case FDT_BEGIN_NODE:
 			name = fdt_get_name(fdt, offset, NULL);
-			child = dt_new_root(name, fdt, offset);
+			child = dt_new_node(name, fdt, offset);
 			assert(child);
 			nextoffset = dt_expand_node(child, fdt, offset);
 
diff --git a/libpdbg/device.h b/libpdbg/device.h
index 05d6c12..cb5bc10 100644
--- a/libpdbg/device.h
+++ b/libpdbg/device.h
@@ -46,8 +46,8 @@ extern u32 last_phandle;
 extern struct pdbg_target *dt_root;
 extern struct pdbg_target *dt_chosen;
 
-/* Create a root node: ie. a parentless one. */
-struct pdbg_target *dt_new_root(const char *name, const void *fdt, int offset);
+/* Create a new node. */
+struct pdbg_target *dt_new_node(const char *name, const void *fdt, int offset);
 
 /* Graft a root node into this tree. */
 bool dt_attach_root(struct pdbg_target *parent, struct pdbg_target *root);
diff --git a/libpdbg/target.c b/libpdbg/target.c
index 1d308cc..341141c 100644
--- a/libpdbg/target.c
+++ b/libpdbg/target.c
@@ -276,7 +276,7 @@ struct hw_unit_info *find_compatible_target(const char *compat)
 
 void pdbg_targets_init(void *fdt)
 {
-	dt_root = dt_new_root("", NULL, 0);
+	dt_root = dt_new_node("", NULL, 0);
 	dt_expand(fdt);
 }
 
-- 
2.17.1



More information about the Pdbg mailing list