From 05898c67c15d73fe50bd87fc939bd9ee6a4275ce Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 24 Feb 2010 18:22:17 +1100 Subject: 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 Acked-by: Grant Likely --- treesource.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'treesource.c') 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); -- cgit v1.2.1