diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-12-09 11:57:39 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-12-13 23:16:20 +0100 |
commit | 16a656139c27c5dc0cd51f06b105e82f78068ef5 (patch) | |
tree | 08af5ee1acbec5982469bf14e0e87f6d0e8e0d3b | |
parent | 1973008ce2ca5038847a6bd87c8a23db4529deeb (diff) | |
download | barebox-16a656139c27c5dc0cd51f06b105e82f78068ef5.tar.gz barebox-16a656139c27c5dc0cd51f06b105e82f78068ef5.tar.xz |
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 <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211209105739.3517998-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/of/base.c | 18 |
1 files 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, "+ "); } } |