[Crosstoolchain-logs] [device-tree-compiler] 254/357: dtc: Strip redundant "name" properties

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:06:19 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.3.x
in repository device-tree-compiler.

commit d028e84140317682140602dcc87dc3aa439e35cb
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Thu Feb 28 20:53:00 2008 +1100

    dtc: Strip redundant "name" properties
    
    If an input device tree has "name" properties which are correct, then
    they are redundant (because they can be derived from the unit name).
    Therefore, extend the checking code for correctness of "name"
    properties to remove them if they are correct.  dtc will still insert
    name properties in the output if that's of a sufficiently old version
    to require them.
    
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 checks.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/checks.c b/checks.c
index 051368b..34941de 100644
--- a/checks.c
+++ b/checks.c
@@ -316,9 +316,14 @@ NODE_CHECK(explicit_phandles, NULL, ERROR);
 static void check_name_properties(struct check *c, struct node *root,
 				  struct node *node)
 {
-	struct property *prop;
+	struct property **pp, *prop = NULL;
+
+	for (pp = &node->proplist; *pp; pp = &((*pp)->next))
+		if (streq((*pp)->name, "name")) {
+			prop = *pp;
+			break;
+		}
 
-	prop = get_property(node, "name");
 	if (!prop)
 		return; /* No name property, that's fine */
 
@@ -326,6 +331,12 @@ static void check_name_properties(struct check *c, struct node *root,
 	    || (memcmp(prop->val.val, node->name, node->basenamelen) != 0))
 		FAIL(c, "\"name\" property in %s is incorrect (\"%s\" instead"
 		     " of base node name)", node->fullpath, prop->val.val);
+
+	/* The name property is correct, and therefore redundant.  Delete it */
+	*pp = prop->next;
+	free(prop->name);
+	data_free(prop->val);
+	free(prop);
 }
 CHECK_IS_STRING(name_is_string, "name", ERROR);
 NODE_CHECK(name_properties, NULL, ERROR, &name_is_string);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list