From 16a656139c27c5dc0cd51f06b105e82f78068ef5 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Thu, 9 Dec 2021 11:57:39 +0100 Subject: commands: of_diff: don't mix tabs and spaces for indentation Nodes are indented with spaces, while properties are indented with tabs, leading to discrepancies when the indentation doesn't start at a tab stop, like when using of_diff: chosen { + barebox-version = "barebox-2021.06.0-20210716-2"; + reset-source = "POR"; + reset-source-instance = <0x0>; + subnode { Fix this by using spaces throughout. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20211209105739.3517998-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- drivers/of/base.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index de75796182..8cefab1782 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2011,12 +2011,7 @@ void of_print_nodes(struct device_node *node, int indent) static void __of_print_property(struct property *p, int indent) { - int i; - - for (i = 0; i < indent; i++) - printf("\t"); - - printf("%s", p->name); + printf("%*s%s", indent * 8, "", p->name); if (p->length) { printf(" = "); of_print_property(of_property_get_value(p), p->length); @@ -2034,17 +2029,14 @@ void of_print_properties(struct device_node *node) static int __of_print_parents(struct device_node *node) { - int indent, i; + int indent; if (!node->parent) return 0; indent = __of_print_parents(node->parent); - for (i = 0; i < indent; i++) - printf("\t"); - - printf("%s {\n", node->name); + printf("%*s%s {\n", indent * 8, "", node->name); return indent + 1; } @@ -2124,14 +2116,14 @@ void of_diff(struct device_node *a, struct device_node *b, int indent) of_diff(ca, cb, indent + 1); } else { of_print_parents(a, &printed); - __of_print_nodes(ca, indent, "-"); + __of_print_nodes(ca, indent, "- "); } } for_each_child_of_node(b, cb) { if (!of_get_child_by_name(a, cb->name)) { of_print_parents(a, &printed); - __of_print_nodes(cb, indent, "+"); + __of_print_nodes(cb, indent, "+ "); } } -- cgit v1.2.3