mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] commands: of_diff: don't mix tabs and spaces for indentation
Date: Mon, 13 Dec 2021 23:16:29 +0100	[thread overview]
Message-ID: <20211213221629.GF6003@pengutronix.de> (raw)
In-Reply-To: <20211209105739.3517998-1-a.fatoum@pengutronix.de>

On Thu, Dec 09, 2021 at 11:57:39AM +0100, Ahmad Fatoum wrote:
> 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>
> ---
>  drivers/of/base.c | 18 +++++-------------
>  1 file changed, 5 insertions(+), 13 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 664a3a411eaf..06e37b0fca4a 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, "+ ");
>  		}
>  	}
>  
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


      reply	other threads:[~2021-12-13 22:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 10:57 Ahmad Fatoum
2021-12-13 22:16 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211213221629.GF6003@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox