[PATCH] dtc: Merge nodes if possible in plugins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



This patch makes it possible to use references to labels in plugins
without creating additional fragments.

Previously the dts below would generate two fragments:

/dts-v1/;
/plugin/;
&x { a: a@0 {};};
&a { b {}; };

Signed-off-by: Fredrik Markstrom <fredrik.markstrom@xxxxxxxxx>
---
 dtc-parser.y | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dtc-parser.y b/dtc-parser.y
index dd70ebf..4f2f6dd 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -196,13 +196,13 @@ devicetree:
 			 *   versioninfo plugindecl memreserves devicetree
 			 * so $-1 is what we want (plugindecl)
 			 */
-			if ($<flags>-1 & DTSF_PLUGIN) {
-				add_orphan_node($1, $3, $2);
-			} else {
-				struct node *target = get_node_by_ref($1, $2);
+			struct node *target = get_node_by_ref($1, $2);
 
-				if (target)
-					merge_nodes(target, $3);
+			if (target)
+				merge_nodes(target, $3);
+			else {
+				if ($<flags>-1 & DTSF_PLUGIN)
+					add_orphan_node($1, $3, $2);
 				else
 					ERROR(&@2, "Label or path %s not found", $2);
 			}
-- 
2.17.1




[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux