mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jan Weitzel <j.weitzel@phytec.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2] commands: of_dump switch to get fixed devictree
Date: Mon, 4 Aug 2014 21:21:41 +0200	[thread overview]
Message-ID: <20140804192141.GO23235@pengutronix.de> (raw)
In-Reply-To: <1406876465-27832-1-git-send-email-j.weitzel@phytec.de>

Hi Jan,

On Fri, Aug 01, 2014 at 09:01:05AM +0200, Jan Weitzel wrote:
> Add a switch to get the devicetree processed by the registered fixups.
> This is also whats the kernel gets.

This is a very useful option.

> 
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
> ---
> v2:	fix CMD OPS
> 
>  commands/of_dump.c |   12 ++++++++++--
>  1 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/commands/of_dump.c b/commands/of_dump.c
> index cafde07..1b487c7 100644
> --- a/commands/of_dump.c
> +++ b/commands/of_dump.c
> @@ -34,16 +34,20 @@ static int do_of_dump(int argc, char *argv[])
>  {
>  	int opt;
>  	int ret;
> +	int fix = 0;
>  	struct device_node *root = NULL, *node, *of_free = NULL;
>  	char *dtbfile = NULL;
>  	size_t size;
>  	const char *nodename;
>  
> -	while ((opt = getopt(argc, argv, "f:")) > 0) {
> +	while ((opt = getopt(argc, argv, "Ff:")) > 0) {
>  		switch (opt) {
>  		case 'f':
>  			dtbfile = optarg;
>  			break;
> +		case 'F':
> +			fix = 1;
> +			break;
>  		default:
>  			return COMMAND_ERROR_USAGE;
>  		}
> @@ -77,6 +81,9 @@ static int do_of_dump(int argc, char *argv[])
>  		root = of_get_root_node();
>  	}
>  
> +	if (fix)
> +		of_get_fixed_tree(root);

of_get_fixed_tree() returns an allocated flat device tree. You should
free it.

As an alternative you could call of_fix_tree() instead.

Also I'm not sure about the API. of_fix_tree manipulates the internal
tree, so when you use of_dump -F once you'll always get the fixed tree
afterwards, even when called without -F. This might be confusing.
We have the same problem elsewhere in the tree though, right now I'm
unsure what to do about it. And then again, I'm on holiday, so I won't
do anything about it this month ;)

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 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:[~2014-08-04 19:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01  7:01 Jan Weitzel
2014-08-04 19:21 ` Sascha Hauer [this message]
2014-08-21 11:25   ` Jan Weitzel
2014-08-21 11:26   ` [PATCH v3] " Jan Weitzel
2014-08-21 12:15     ` Antony Pavlov
2014-08-21 12:15       ` [PATCH v4] " Jan Weitzel
2014-09-01 10:34       ` [PATCH v3] " Sascha Hauer
2014-09-01 10:38     ` Sascha Hauer
2014-09-01 13:28       ` Jan Weitzel

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=20140804192141.GO23235@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=j.weitzel@phytec.de \
    /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