diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2010-09-20 16:33:34 -0600 |
---|---|---|
committer | Jon Loeliger <jdl@jdl.com> | 2010-09-21 10:15:51 -0500 |
commit | 8773e12fa9f5109172a779aa2a83b4464e5273cc (patch) | |
tree | c35ff080647b835570b4ffbf139039fbcc188a6f /dtc-parser.y | |
parent | 390635762d97502bda9c295fcb61b45d04d3d8d2 (diff) | |
download | dtc-8773e12fa9f5109172a779aa2a83b4464e5273cc.tar.gz |
Add merging of labelled subnodes. This patch allows the following
syntax:
/ {
child {
label: subchild {
};
};
};
&label {
prop = "value";
};
which will result in the following tree:
/ {
child {
label: subchild {
prop = "value";
};
};
};
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'dtc-parser.y')
-rw-r--r-- | dtc-parser.y | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/dtc-parser.y b/dtc-parser.y index dea19c1..0aaf8e8 100644 --- a/dtc-parser.y +++ b/dtc-parser.y @@ -75,7 +75,6 @@ static unsigned long long eval_literal(const char *s, int base, int bits); %type <proplist> proplist %type <node> devicetree -%type <node> devicetrees %type <node> nodedef %type <node> subnode %type <nodelist> subnodes @@ -83,7 +82,7 @@ static unsigned long long eval_literal(const char *s, int base, int bits); %% sourcefile: - DT_V1 ';' memreserves devicetrees + DT_V1 ';' memreserves devicetree { the_boot_info = build_boot_info($3, $4, guess_boot_cpuid($4)); @@ -120,21 +119,26 @@ addr: } ; -devicetrees: - devicetree +devicetree: + '/' nodedef { - $$ = $1; + $$ = name_node($2, ""); } - | devicetrees devicetree + | devicetree '/' nodedef { - $$ = merge_nodes($1, $2); + $$ = merge_nodes($1, $3); } - ; - -devicetree: - '/' nodedef + | devicetree DT_REF nodedef { - $$ = name_node($2, ""); + struct node *target; + + target = get_node_by_label($1, $2); + if (target) + merge_nodes(target, $3); + else + yyerror("label does not exist in " + " node redefinition"); + $$ = $1; } ; |