[Crosstoolchain-logs] [device-tree-compiler] 19/29: checks: add string list check for *-names properties

Vagrant Cascadian vagrant at moszumanska.debian.org
Tue Jan 23 06:34:38 UTC 2018


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

vagrant pushed a commit to branch debian/master
in repository device-tree-compiler.

commit 18a3d84bb802d3281d8df91a973dce271f5523fb
Author: Rob Herring <robh at kernel.org>
Date:   Tue Dec 12 16:46:26 2017 -0600

    checks: add string list check for *-names properties
    
    Add a string list check for common properties ending in "-names" such as
    reg-names or interrupt-names.
    
    Signed-off-by: Rob Herring <robh at kernel.org>
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 checks.c                   | 18 +++++++++++++++++-
 tests/bad-string-props.dts |  1 +
 tests/run_tests.sh         |  2 +-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/checks.c b/checks.c
index cf670dd..e4f5cb9 100644
--- a/checks.c
+++ b/checks.c
@@ -620,6 +620,22 @@ WARNING_IF_NOT_STRING(label_is_string, "label");
 
 WARNING_IF_NOT_STRING_LIST(compatible_is_string_list, "compatible");
 
+static void check_names_is_string_list(struct check *c, struct dt_info *dti,
+				       struct node *node)
+{
+	struct property *prop;
+
+	for_each_property(node, prop) {
+		const char *s = strrchr(prop->name, '-');
+		if (!s || !streq(s, "-names"))
+			continue;
+
+		c->data = prop->name;
+		check_is_string_list(c, dti, node);
+	}
+}
+WARNING(names_is_string_list, check_names_is_string_list, NULL);
+
 static void fixup_addr_size_cells(struct check *c, struct dt_info *dti,
 				  struct node *node)
 {
@@ -1271,7 +1287,7 @@ static struct check *check_table[] = {
 	&device_type_is_string, &model_is_string, &status_is_string,
 	&label_is_string,
 
-	&compatible_is_string_list,
+	&compatible_is_string_list, &names_is_string_list,
 
 	&property_name_chars_strict,
 	&node_name_chars_strict,
diff --git a/tests/bad-string-props.dts b/tests/bad-string-props.dts
index 9362ee8..6694704 100644
--- a/tests/bad-string-props.dts
+++ b/tests/bad-string-props.dts
@@ -6,6 +6,7 @@
 	status = <0xdeadbeef>;
 	label = <0xdeadbeef>;
 
+	foobar-names = "foo", <1>;
 
 	node {
 		compatible = "good", <0xdeadbeef>;
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 910a71c..d36dffb 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -546,7 +546,7 @@ dtc_tests () {
     check_tests bad-name-property.dts name_properties
 
     check_tests bad-ncells.dts address_cells_is_cell size_cells_is_cell interrupt_cells_is_cell
-    check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string label_is_string compatible_is_string_list
+    check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string label_is_string compatible_is_string_list names_is_string_list
     check_tests bad-reg-ranges.dts reg_format ranges_format
     check_tests bad-empty-ranges.dts ranges_format
     check_tests reg-ranges-root.dts reg_format ranges_format

-- 
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