summaryrefslogtreecommitdiff
path: root/treesource.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2010-02-24 18:22:17 +1100
committerJon Loeliger <jdl@jdl.com>2010-02-24 08:48:51 -0600
commit05898c67c15d73fe50bd87fc939bd9ee6a4275ce (patch)
treea8ea4e24ccdd0e8a21dc028e2b55a1226d6d3bc2 /treesource.c
parent49c2da308534a4bffb67d53b5a7f8e5f05c305b9 (diff)
downloaddtc-05898c67c15d73fe50bd87fc939bd9ee6a4275ce.tar.gz
dtc: Allow multiple labels on nodes and properties
At present, both the grammar and our internal data structures mean that there can be only one label on a node or property. This is a fairly arbitrary constraint, given that any number of value labels can appear at the same point, and that in C you can have any number of labels on the same statement. This is pretty much a non-issue now, but it may become important with some of the extensions that Grant and I have in mind. It's not that hard to change, so this patch does so, allowing an arbitrary number of labels on any given node or property. As usual a testcase is added too. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'treesource.c')
-rw-r--r--treesource.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/treesource.c b/treesource.c
index 331c22c..c09aafa 100644
--- a/treesource.c
+++ b/treesource.c
@@ -235,10 +235,11 @@ static void write_tree_source_node(FILE *f, struct node *tree, int level)
{
struct property *prop;
struct node *child;
+ struct label *l;
write_prefix(f, level);
- if (tree->label)
- fprintf(f, "%s: ", tree->label);
+ for_each_label(tree->labels, l)
+ fprintf(f, "%s: ", l->label);
if (tree->name && (*tree->name))
fprintf(f, "%s {\n", tree->name);
else
@@ -246,8 +247,8 @@ static void write_tree_source_node(FILE *f, struct node *tree, int level)
for_each_property(tree, prop) {
write_prefix(f, level+1);
- if (prop->label)
- fprintf(f, "%s: ", prop->label);
+ for_each_label(prop->labels, l)
+ fprintf(f, "%s: ", l->label);
fprintf(f, "%s", prop->name);
write_propval(f, prop);
}
@@ -267,8 +268,10 @@ void dt_to_source(FILE *f, struct boot_info *bi)
fprintf(f, "/dts-v1/;\n\n");
for (re = bi->reservelist; re; re = re->next) {
- if (re->label)
- fprintf(f, "%s: ", re->label);
+ struct label *l;
+
+ for_each_label(re->labels, l)
+ fprintf(f, "%s: ", l->label);
fprintf(f, "/memreserve/\t0x%016llx 0x%016llx;\n",
(unsigned long long)re->re.address,
(unsigned long long)re->re.size);