From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: Andre Przywara <andre.przywara@arm.com>
Cc: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
u-boot@lists.denx.de
Subject: Re: [PATCH v2 2/3] cmd: fdt: allow standalone "fdt move"
Date: Fri, 10 Feb 2023 12:34:06 +0100 [thread overview]
Message-ID: <20230210123406.329cb264@karo-electronics.de> (raw)
In-Reply-To: <20230210110213.2531190-3-andre.przywara@arm.com>
Hi,
On Fri, 10 Feb 2023 11:02:12 +0000 Andre Przywara wrote:
> At the moment every subcommand of "fdt", except "addr" itself, requires
> the DT address to be set first. We explicitly check for that before even
> comparing against the subcommands' string.
> This early bailout also affects the "move" subcommand, even though that
> does not require or rely on a previous call to "fdt addr". In fact it
> even sets the FDT address to the target of the move command, so is a
> perfect beginning for a sequence of fdt commands.
>
> Move the check for a previously set FDT address to after we handle the
> "move" command also, so we don't need a dummy call to "fdt addr" first,
> before being able to move the devicetree.
>
> This skips one pointless "fdt addr" call in scripts which aim to alter
> the control DT, but need to copy it to a safe location first (for
> instance to $fdt_addr_r).
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> cmd/fdt.c | 28 +++++++++++++++++-----------
> 1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/cmd/fdt.c b/cmd/fdt.c
> index 0ba691c573b..1972490bdc2 100644
> --- a/cmd/fdt.c
> +++ b/cmd/fdt.c
> @@ -208,19 +208,11 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
> }
>
> return CMD_RET_SUCCESS;
> - }
> -
> - if (!working_fdt) {
> - puts("No FDT memory address configured. Please configure\n"
> - "the FDT address via \"fdt addr <address>\" command.\n"
> - "Aborting!\n");
> - return CMD_RET_FAILURE;
> - }
>
> /*
> * Move the working_fdt
> */
> - if (strncmp(argv[1], "mo", 2) == 0) {
> + } else if (strncmp(argv[1], "mo", 2) == 0) {
> struct fdt_header *newaddr;
> int len;
> int err;
> @@ -263,9 +255,20 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
> return 1;
> }
It's not part of your changes, but this should rather be:
return CMD_RET_FAILURE;
Lothar Waßmann
next prev parent reply other threads:[~2023-02-10 11:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-10 11:02 [PATCH v2 0/3] fdt: introduce "fsapply" command Andre Przywara
2023-02-10 11:02 ` [PATCH v2 1/3] cmd: fdt: move: Use map_sysmem to convert pointers Andre Przywara
2023-02-13 0:34 ` Simon Glass
2023-02-10 11:02 ` [PATCH v2 2/3] cmd: fdt: allow standalone "fdt move" Andre Przywara
2023-02-10 11:34 ` Lothar Waßmann [this message]
2023-02-13 0:34 ` Simon Glass
2023-02-10 11:02 ` [PATCH v2 3/3] fdt: introduce fsapply command Andre Przywara
2023-02-10 11:32 ` Lothar Waßmann
2023-02-10 16:05 ` Simon Glass
2023-02-13 17:26 ` Andre Przywara
2023-02-13 18:12 ` Simon Glass
2023-02-16 16:13 ` [PATCH v2 0/3] fdt: introduce "fsapply" command Heinrich Schuchardt
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=20230210123406.329cb264@karo-electronics.de \
--to=lw@karo-electronics.de \
--cc=andre.przywara@arm.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.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