[Crosstoolchain-logs] [device-tree-compiler] 354/357: Allow nodes to be referenced by path at the top level.

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:06:31 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 73ae43ea44a40c2ac00dd94523f270177a1e72e9
Author: John Bonesio <bones at secretlab.ca>
Date:   Tue Nov 2 15:55:04 2010 -0700

    Allow nodes to be referenced by path at the top level.
    
    When nodes are modified by merging device trees, nodes to be updated/merged can
    be specified by a label. Specifying nodes by full path (instead of label)
    doesn't quite work. This patch fixes that.
    
    Signed-off-by: John Bonesio <bones at secretlab.ca>
    Acked-by: David Gibson <david at gibson.dropbear.id.au>
---
 dtc-lexer.l                     |  2 +-
 dtc-parser.y                    |  5 ++---
 tests/run_tests.sh              |  2 ++
 tests/test_tree1_merge_path.dts | 41 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/dtc-lexer.l b/dtc-lexer.l
index 081e13a..e866ea5 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -115,7 +115,7 @@ static int pop_input_file(void);
 			return DT_REF;
 		}
 
-"&{/"{PATHCHAR}+\}	{	/* new-style path reference */
+<*>"&{/"{PATHCHAR}+\}	{	/* new-style path reference */
 			yytext[yyleng-1] = '\0';
 			DPRINT("Ref: %s\n", yytext+2);
 			yylval.labelref = xstrdup(yytext+2);
diff --git a/dtc-parser.y b/dtc-parser.y
index b58ba8e..5e84a67 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -131,13 +131,12 @@ devicetree:
 		}
 	| devicetree DT_REF nodedef
 		{
-			struct node *target;
+			struct node *target = get_node_by_ref($1, $2);
 
-			target = get_node_by_label($1, $2);
 			if (target)
 				merge_nodes(target, $3);
 			else
-				print_error("label, '%s' not found", $2);
+				print_error("label or path, '%s', not found", $2);
 			$$ = $1;
 		}
 	;
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 77ce80d..a887254 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -305,6 +305,8 @@ dtc_tests () {
     run_dtc_test -I dts -O dtb -o multilabel_merge.test.dtb multilabel_merge.dts
     run_test references multilabel.test.dtb
     run_test dtbs_equal_ordered multilabel.test.dtb multilabel_merge.test.dtb
+    run_dtc_test -I dts -O dtb -o dtc_tree1_merge_path.test.dtb test_tree1_merge_path.dts
+    tree1_tests dtc_tree1_merge_path.test.dtb test_tree1.dtb
 
     # Check some checks
     check_tests dup-nodename.dts duplicate_node_names
diff --git a/tests/test_tree1_merge_path.dts b/tests/test_tree1_merge_path.dts
new file mode 100644
index 0000000..d68713b
--- /dev/null
+++ b/tests/test_tree1_merge_path.dts
@@ -0,0 +1,41 @@
+/dts-v1/;
+
+/memreserve/ 0xdeadbeef00000000 0x100000;
+/memreserve/ 123456789 010000;
+
+/ {
+	compatible = "test_tree1";
+	prop-int = <0xdeadbeef>;
+	prop-str = "hello world";
+
+	subnode at 1 {
+		compatible = "subnode1";
+		prop-int = [deadbeef];
+
+		subsubnode {
+			compatible = "subsubnode1", "subsubnode";
+			prop-int = <0xdeadbeef>;
+		};
+
+		ss1 {
+		};
+	};
+
+	subnode at 2 {
+		linux,phandle = <0x2000>;
+		prop-int = <123456789>;
+
+		ssn0: subsubnode at 0 {
+			phandle = <0x2001>;
+			prop-int = <0xbad>;
+		};
+
+		ss2 {
+		};
+	};
+};
+
+&{/subnode at 2/subsubnode at 0} {
+	compatible = "subsubnode2", "subsubnode";
+	prop-int = <0726746425>;
+};

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