aboutsummaryrefslogtreecommitdiff
path: root/treesource.c
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2018-09-14 13:39:06 -0500
committerDavid Gibson <david@gibson.dropbear.id.au>2018-09-17 11:54:31 +1000
commitd448f9a5fd941a69cceb7008d3ac9ac0396f64d8 (patch)
treecd017e971b8eb789e260af95083768c55309d7fe /treesource.c
parentc86da84d30e4b72cfb4fee22b62bea4257bc14bf (diff)
downloaddtc-d448f9a5fd941a69cceb7008d3ac9ac0396f64d8.tar.gz
Revert dts output formatting changes of spaces around brackets
Commit 32b9c6130762 ("Preserve datatype markers when emitting dts format") add spaces between <> and [] and the encapsulated numbers. Fix this to keep the prior formatting and not break some users needlessly. Fixes: 32b9c6130762 ("Preserve datatype markers when emitting dts format") Reported-by: Stewart Smith <stewart@linux.ibm.com> Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'treesource.c')
-rw-r--r--treesource.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/treesource.c b/treesource.c
index f2874f1..28cd135 100644
--- a/treesource.c
+++ b/treesource.c
@@ -118,18 +118,20 @@ static void write_propval_int(FILE *f, const char *p, size_t len, size_t width)
for (; p < end; p += width) {
switch (width) {
case 1:
- fprintf(f, " %02"PRIx8, *(const uint8_t*)p);
+ fprintf(f, "%02"PRIx8, *(const uint8_t*)p);
break;
case 2:
- fprintf(f, " 0x%02"PRIx16, fdt16_to_cpu(*(const fdt16_t*)p));
+ fprintf(f, "0x%02"PRIx16, fdt16_to_cpu(*(const fdt16_t*)p));
break;
case 4:
- fprintf(f, " 0x%02"PRIx32, fdt32_to_cpu(*(const fdt32_t*)p));
+ fprintf(f, "0x%02"PRIx32, fdt32_to_cpu(*(const fdt32_t*)p));
break;
case 8:
- fprintf(f, " 0x%02"PRIx64, fdt64_to_cpu(*(const fdt64_t*)p));
+ fprintf(f, "0x%02"PRIx64, fdt64_to_cpu(*(const fdt64_t*)p));
break;
}
+ if (p + width < end)
+ fputc(' ', f);
}
}
@@ -162,10 +164,10 @@ static const char *delim_start[] = {
[TYPE_STRING] = "",
};
static const char *delim_end[] = {
- [TYPE_UINT8] = " ]",
- [TYPE_UINT16] = " >",
- [TYPE_UINT32] = " >",
- [TYPE_UINT64] = " >",
+ [TYPE_UINT8] = "]",
+ [TYPE_UINT16] = ">",
+ [TYPE_UINT32] = ">",
+ [TYPE_UINT64] = ">",
[TYPE_STRING] = "",
};