diff options
author | Pantelis Antoniou <pantelis.antoniou@konsulko.com> | 2017-06-14 17:53:05 +0300 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2017-09-28 15:44:22 +1000 |
commit | 737b2df39cc8c5667e66b006618293d13905cf78 (patch) | |
tree | e67e8310535c09cd1c25871ea1a5e33c7374ae1e /dtc-parser.y | |
parent | 497432fd2131967f349e69dc5d259072151cc4b4 (diff) | |
download | dtc-737b2df39cc8c5667e66b006618293d13905cf78.zip dtc-737b2df39cc8c5667e66b006618293d13905cf78.tar.gz dtc-737b2df39cc8c5667e66b006618293d13905cf78.tar.bz2 |
overlay: Add syntactic sugar version of overlays
For simple overlays that use a single target there exists a
simpler syntax version.
&foo { }; generates an overlay with a single target at foo.
Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'dtc-parser.y')
-rw-r--r-- | dtc-parser.y | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/dtc-parser.y b/dtc-parser.y index ca3f500..affc81a 100644 --- a/dtc-parser.y +++ b/dtc-parser.y @@ -182,10 +182,19 @@ devicetree: { struct node *target = get_node_by_ref($1, $2); - if (target) + if (target) { merge_nodes(target, $3); - else - ERROR(&@2, "Label or path %s not found", $2); + } else { + /* + * We rely on the rule being always: + * versioninfo plugindecl memreserves devicetree + * so $-1 is what we want (plugindecl) + */ + if ($<flags>-1 & DTSF_PLUGIN) + add_orphan_node($1, $3, $2); + else + ERROR(&@2, "Label or path %s not found", $2); + } $$ = $1; } | devicetree DT_DEL_NODE DT_REF ';' @@ -200,6 +209,11 @@ devicetree: $$ = $1; } + | /* empty */ + { + /* build empty node */ + $$ = name_node(build_node(NULL, NULL), ""); + } ; nodedef: |