[Crosstoolchain-logs] [device-tree-compiler] 218/357: dtc: Migrate "string property" checks to new framework

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:06:15 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 faf037f0ef294412a3bb04be4032bf2f008a5945
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Thu Dec 6 17:01:07 2007 +1100

    dtc: Migrate "string property" checks to new framework
    
    This patch converts to the new tree checking framework those checks
    which verify that certain properties (device_type, model) have a
    string value, when present.
    
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 checks.c                   | 18 +++++-------------
 tests/bad-string-props.dts |  7 +++++++
 tests/run_tests.sh         |  2 ++
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/checks.c b/checks.c
index 5f76ff2..f9a9a0e 100644
--- a/checks.c
+++ b/checks.c
@@ -351,6 +351,10 @@ CHECK_IS_CELL(address_cells_is_cell, "#address-cells", WARN);
 CHECK_IS_CELL(size_cells_is_cell, "#size-cells", WARN);
 CHECK_IS_CELL(interrupt_cells_is_cell, "#interrupt-cells", WARN);
 
+CHECK_IS_STRING(device_type_is_string, "device_type", WARN);
+CHECK_IS_STRING(model_is_string, "model", WARN);
+CHECK_IS_STRING(status_is_string, "status", WARN);
+
 static struct check *check_table[] = {
 	&duplicate_node_names, &duplicate_property_names,
 	&name_is_string, &name_properties,
@@ -358,6 +362,7 @@ static struct check *check_table[] = {
 	&phandle_references, &path_references,
 
 	&address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell,
+	&device_type_is_string, &model_is_string, &status_is_string,
 };
 
 int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys);
@@ -418,24 +423,11 @@ static int must_be_cells(struct property *prop, struct node *node)
 	return 1;
 }
 
-static int must_be_string(struct property *prop, struct node *node)
-{
-	if (! data_is_one_string(prop->val)) {
-		ERRMSG("\"%s\" property in %s is not a string\n",
-		       prop->name, node->fullpath);
-		return 0;
-	}
-
-	return 1;
-}
-
 static struct {
 	char *propname;
 	int (*check_fn)(struct property *prop, struct node *node);
 } prop_checker_table[] = {
 	{"reg", must_be_cells},
-	{"model", must_be_string},
-	{"device_type", must_be_string},
 };
 
 static int check_properties(struct node *node)
diff --git a/tests/bad-string-props.dts b/tests/bad-string-props.dts
new file mode 100644
index 0000000..396f820
--- /dev/null
+++ b/tests/bad-string-props.dts
@@ -0,0 +1,7 @@
+/dts-v1/;
+
+/ {
+	device_type = <0xdeadbeef>;
+	model = <0xdeadbeef>;
+	status = <0xdeadbeef>;
+};
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 9e0af51..c0003a2 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -168,6 +168,8 @@ dtc_tests () {
     run_test dtc-checkfails.sh name_properties -- -I dts -O dtb bad-name-property.dts
 
     run_test dtc-checkfails.sh address_cells_is_cell size_cells_is_cell interrupt_cells_is_cell -- -I dts -O dtb bad-ncells.dts
+    run_test dtc-checkfails.sh device_type_is_string model_is_string status_is_string -- -I dts -O dtb bad-string-props.dts
+
 }
 
 while getopts "vt:m" ARG ; do

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