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>
This commit is contained in:
David Gibson 2010-09-20 16:33:34 -06:00 committed by Jon Loeliger
parent 390635762d
commit 8773e12fa9
7 changed files with 74 additions and 18 deletions

View file

@ -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,22 +119,27 @@ addr:
}
;
devicetrees:
devicetree
{
$$ = $1;
}
| devicetrees devicetree
{
$$ = merge_nodes($1, $2);
}
;
devicetree:
'/' nodedef
{
$$ = name_node($2, "");
}
| devicetree '/' nodedef
{
$$ = merge_nodes($1, $3);
}
| devicetree DT_REF nodedef
{
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;
}
;
nodedef: