From: Stefan Agner <stefan@agner.ch>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/1] imx8: cpu: fix warning for cpu_imx_get_temp
Date: Mon, 13 May 2019 15:56:10 +0200 [thread overview]
Message-ID: <b0ce7b8d27a6a7ebcf45bbec7ccac88f@agner.ch> (raw)
In-Reply-To: <20190513104638.9326-1-igor.opaniuk@toradex.com>
Hi Igor,
On 13.05.2019 12:46, Igor Opaniuk wrote:
> cpu_imx_get_temp() definition is wrapped with a ifdef macro,
> therefore all function references should be also wrapped the same way
> instead IS_ENABLED() usage.
>
> Fix warning:
> arch/arm/mach-imx/imx8/cpu.c: In function ‘cpu_imx_get_desc’:
> arch/arm/mach-imx/imx8/cpu.c:612:40: warning: implicit declaration of
> function ‘cpu_imx_get_temp’; did you mean ‘cpu_imx_get_desc’?
> [-Wimplicit-function-declaration]
> ret = snprintf(buf, size, " at %dC", cpu_imx_get_temp());
> ^~~~~~~~~~~~~~~~
> cpu_imx_get_desc
> cpu_imx_get_desc
>
Using IS_ENABLED is typically preferred over ifdef since it assures that
the code is compileable even if CONFIG_IMX_SCU_THERMAL is not enabled.
I'd rather prefer we drop the the ifdef around cpu_imx_get_temp(). The
linker will remove the function in case CONFIG_IMX_SCU_THERMAL is not
enabled.
--
Stefan
> Fixes: 82467cb217 ("imx8: cpu: get temperature when print cpu desc")
> Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
> ---
> arch/arm/mach-imx/imx8/cpu.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c
> index 12596c6387..616baed7cc 100644
> --- a/arch/arm/mach-imx/imx8/cpu.c
> +++ b/arch/arm/mach-imx/imx8/cpu.c
> @@ -606,11 +606,11 @@ int cpu_imx_get_desc(struct udevice *dev, char
> *buf, int size)
> ret = snprintf(buf, size, "NXP i.MX8%s Rev%s %s at %u MHz",
> plat->type, plat->rev, plat->name, plat->freq_mhz);
>
> - if (IS_ENABLED(CONFIG_IMX_SCU_THERMAL)) {
> - buf = buf + ret;
> - size = size - ret;
> - ret = snprintf(buf, size, " at %dC", cpu_imx_get_temp());
> - }
> +#if defined(CONFIG_IMX_SCU_THERMAL)
> + buf = buf + ret;
> + size = size - ret;
> + ret = snprintf(buf, size, " at %dC", cpu_imx_get_temp());
> +#endif
>
> snprintf(buf + ret, size - ret, "\n");
next prev parent reply other threads:[~2019-05-13 13:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-13 10:46 [U-Boot] [PATCH 1/1] imx8: cpu: fix warning for cpu_imx_get_temp Igor Opaniuk
2019-05-13 13:56 ` Stefan Agner [this message]
2019-05-14 1:08 ` Peng Fan
2019-05-14 9:24 ` Igor Opaniuk
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=b0ce7b8d27a6a7ebcf45bbec7ccac88f@agner.ch \
--to=stefan@agner.ch \
--cc=u-boot@lists.denx.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