]> Git Repo - J-u-boot.git/blobdiff - scripts/dtc/dtc-parser.y
dtc: add ability to make nodes conditional on them being referenced
[J-u-boot.git] / scripts / dtc / dtc-parser.y
index 44af170abfeaca34a94217d0cf7519568e27b72a..66ff7f7d8eb73ca4c4a2d1275caf788741366ed3 100644 (file)
@@ -63,6 +63,7 @@ extern bool treesource_error;
 %token DT_BITS
 %token DT_DEL_PROP
 %token DT_DEL_NODE
+%token DT_OMIT_NO_REF
 %token <propnodename> DT_PROPNODENAME
 %token <integer> DT_LITERAL
 %token <integer> DT_CHAR_LITERAL
@@ -217,6 +218,18 @@ devicetree:
                                ERROR(&@3, "Label or path %s not found", $3);
 
 
+                       $$ = $1;
+               }
+       | devicetree DT_OMIT_NO_REF DT_REF ';'
+               {
+                       struct node *target = get_node_by_ref($1, $3);
+
+                       if (target)
+                               omit_node_if_unused(target);
+                       else
+                               ERROR(&@3, "Label or path %s not found", $3);
+
+
                        $$ = $1;
                }
        ;
@@ -523,6 +536,10 @@ subnode:
                {
                        $$ = name_node(build_node_delete(), $2);
                }
+       | DT_OMIT_NO_REF subnode
+               {
+                       $$ = omit_node_if_unused($2);
+               }
        | DT_LABEL subnode
                {
                        add_label(&$2->labels, $1);
This page took 0.026106 seconds and 4 git commands to generate.