On 3/17/23 18:27, Peter Hoyes wrote:
On 17/03/2023 12:17, Marek Vasut wrote:
On 3/16/23 17:34, Peter Hoyes wrote:
From: Peter Hoyes <peter.ho...@arm.com>

64597346 "fdt: Add -q option to fdt addr for distro_bootcmd" introduced
the -q option for fdt addr, which sets the current working fdt address
without printing any output.

baf41410 "fdt: Show a message when the working FDT changes" made the
utility function set_working_fdt_addr (in cmd/fdt.c) output a message
on each invocation, even if called via fdt addr -q, in which case its
output is now slightly noisier.

To fix this, move the printf outside of set_working_fdt_addr to three
call sites:
  * bootm_find_images (the use case for which the additional output was
    added in baf41410).
  * fdt addr, but only if the 'quiet' argument is not set.
  * fdt move.

This also has the advantage of printing the specified address instead of
the translated address when using the sandbox.

Remove assertions from the fdt addr test case when:
  * Calling set_working_fdt_addr directly.
  * Calling fdt addr with the -q argument.

Why not just pass the 'quiet' flag to set_working_fdt_addr() to avoid duplication ?

I considered this too, but there are other machine-specific call sites and I was trying to avoid adding an extra argument everywhere just for logging.

I'll send a v2 with a 'quiet' argument on Monday.

Hmmmm, what about creating a wrapper with the extra logging ? That way, you can have the logging in one place, without introducing the extra parameter.

int set_working_fdt_addr_verbose(...) {
 ret = set_working_fdt_addr();
 printf(...);
 return ret;
}

Reply via email to