u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Michal Simek <monstr@monstr.eu>
To: Ovidiu Panait <ovpanait@gmail.com>
Cc: u-boot@lists.denx.de,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	 Dzmitry Sankouski <dsankouski@gmail.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	 Jason Liu <jason.hui.liu@nxp.com>,
	Simon Glass <sjg@chromium.org>
Subject: Re: [PATCH 3/4] cmd: bdinfo: introduce bdinfo_print_size() helper
Date: Thu, 25 Aug 2022 11:06:35 +0200	[thread overview]
Message-ID: <CAHTX3dJ4sDgjA1yYKhNddTxsA-FbQdpgruAv=HaKJj6vFUJwow@mail.gmail.com> (raw)
In-Reply-To: <20220825064131.673958-3-ovpanait@gmail.com>

čt 25. 8. 2022 v 8:42 odesílatel Ovidiu Panait <ovpanait@gmail.com> napsal:
>
> Add bdinfo_print_size() helper to display size variables (such as cache
> sizes) in bdinfo format. The size is printed as "xxx Bytes", "xxx KiB",
> "xxx MiB", "xxx GiB", etc as needed;
>
> Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
> ---
>
>  cmd/bdinfo.c   |  7 +++++++
>  include/init.h | 13 +++++++++++++
>  2 files changed, 20 insertions(+)
>
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index 37cd8a57eb..9e23c4dd8f 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -16,9 +16,16 @@
>  #include <vsprintf.h>
>  #include <asm/cache.h>
>  #include <asm/global_data.h>
> +#include <display_options.h>
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> +void bdinfo_print_size(const char *name, uint64_t size)
> +{
> +       printf("%-12s= ", name);
> +       print_size(size, "\n");
> +}
> +
>  void bdinfo_print_num_l(const char *name, ulong value)
>  {
>         printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value);
> diff --git a/include/init.h b/include/init.h
> index 7b8f62c121..02bb4ce13e 100644
> --- a/include/init.h
> +++ b/include/init.h
> @@ -343,6 +343,19 @@ void bdinfo_print_num_ll(const char *name, unsigned long long value);
>  /* Print a clock speed in MHz */
>  void bdinfo_print_mhz(const char *name, unsigned long hz);
>
> +/**
> + * bdinfo_print_size - print size variables in bdinfo format
> + * @name:      string to print before the size
> + * @size:      size to print
> + *
> + * Helper function for displaying size variables as properly formatted bdinfo
> + * entries. The size is printed as "xxx Bytes", "xxx KiB", "xxx MiB",
> + * "xxx GiB", etc. as needed;
> + *
> + * For use in arch_print_bdinfo().
> + */
> +void bdinfo_print_size(const char *name, uint64_t size);
> +
>  /* Show arch-specific information for the 'bd' command */
>  void arch_print_bdinfo(void);
>
> --
> 2.25.1
>

No problem with this code. If there is any problem you can include it
directly to mb implementation but
make sense to have it in generic location.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

  reply	other threads:[~2022-08-25  9:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25  6:41 [PATCH 1/4] microblaze: drop CONFIG_SYS_INIT_RAM_ADDR and CONFIG_SYS_INIT_RAM_SIZE Ovidiu Panait
2022-08-25  6:41 ` [PATCH 2/4] cpu: microblaze: remove unused ret variable Ovidiu Panait
2022-08-25  8:59   ` Michal Simek
2022-08-27 17:48     ` Ovidiu Panait
2022-08-25  6:41 ` [PATCH 3/4] cmd: bdinfo: introduce bdinfo_print_size() helper Ovidiu Panait
2022-08-25  9:06   ` Michal Simek [this message]
2022-08-25 15:01   ` Simon Glass
2022-08-25  6:41 ` [PATCH 4/4] microblaze: add arch_print_bdinfo() implementation Ovidiu Panait
2022-08-25  9:04   ` Michal Simek
2022-08-25  8:43 ` [PATCH 1/4] microblaze: drop CONFIG_SYS_INIT_RAM_ADDR and CONFIG_SYS_INIT_RAM_SIZE Michal Simek

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='CAHTX3dJ4sDgjA1yYKhNddTxsA-FbQdpgruAv=HaKJj6vFUJwow@mail.gmail.com' \
    --to=monstr@monstr.eu \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dsankouski@gmail.com \
    --cc=jason.hui.liu@nxp.com \
    --cc=ovpanait@gmail.com \
    --cc=sjg@chromium.org \
    --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;
as well as URLs for NNTP newsgroup(s).