Skip to contentSkip to conversation

imx8: cpu: fix warning for cpu_imx_get_temp

PATCH Superseded Igor Opaniuk 3 participants 4 messages May 13, 2019 – May 14, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx8: cpu: fix warning for cpu_imx_get_temp

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
Fixes 82467cb217 ("imx8: cpu: get temperature when print cpu desc")
---
 arch/arm/mach-imx/imx8/cpu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-imx/imx8/cpu.c +5 -5
index 12596c6387..616baed7cc 100644
@@ -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");
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 imx8: cpu: fix warning for cpu_imx_get_temp

Hi Igor,

Quoted 9 lines · Igor Opaniuk

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]

Quoted 5 lines
   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

Quoted 27 lines
Fixes 82467cb217 ("imx8: cpu: get temperature when print cpu desc")
---
 arch/arm/mach-imx/imx8/cpu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-imx/imx8/cpu.c +5 -5
index 12596c6387..616baed7cc 100644
@@ -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");
#2 lore raw

PATCH 1/1 imx8: cpu: fix warning for cpu_imx_get_temp

Hi Igor,

Not found your original mail, so reply Stefan's mail here.

Quoted 11 lines

-----Original Message-----
From: Stefan Agner [mailto:stefan at agner.ch]
Sent: 2019年5月13日 21:56
To: Igor Opaniuk <[email protected]>
Cc: u-boot at lists.denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; albert.u.boot at aribaud.net; Peng Fan <[email protected]>; agust at denx.de; Marcel Ziswiler <[email protected]>; marcel at ziswiler.com; Max Krummenacher <[email protected]>; sbabic at denx.de
Subject: Re: [PATCH 1/1] imx8: cpu: fix warning for cpu_imx_get_temp

Quoted 6 lines

Hi Igor,

Quoted 3 lines · Igor Opaniuk

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.

Are you trying to fix https://patchwork.ozlabs.org/patch/1095430/ ?

Thanks,
Peng

Quoted 47 lines
Quoted 11 lines

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

Quoted 26 lines
Fixes 82467cb217 ("imx8: cpu: get temperature when print cpu desc")
---
 arch/arm/mach-imx/imx8/cpu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-imx/imx8/cpu.c index 12596c6387..616baed7cc 100644

arch/arm/mach-imx/imx8/cpu.c +4 -5
@@ -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");
#3 lore raw

PATCH 1/1 imx8: cpu: fix warning for cpu_imx_get_temp

Hi Peng,

Seems this is a glitch, I was working with the local forked tree (a copy of the latest U-boot mainline master) + manually applied patch series for Toradex Colibri iMX8QXP [1]/Apalis iMX8QM [2] support on top of it (that are still pending in the U-boot ML),
but seems that some of your patches were also applied and I wasn't aware about this (I thought that they were already in next).

So just ignore this patch. Thanks

[1]: https://patchwork.ozlabs.org/project/uboot/list/?series=105770
[2]: https://patchwork.ozlabs.org/project/uboot/list/?series=105774

Quoted 79 lines · Peng Fan

Hi Igor,

Not found your original mail, so reply Stefan's mail here.

Quoted 11 lines

-----Original Message-----
From: Stefan Agner [mailto:stefan at agner.ch]
Sent: 2019年5月13日 21:56
To: Igor Opaniuk <[email protected]>
Cc: u-boot at lists.denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; albert.u.boot at aribaud.net; Peng Fan <[email protected]>; agust at denx.de; Marcel Ziswiler <[email protected]>; marcel at ziswiler.com; Max Krummenacher <[email protected]>; sbabic at denx.de
Subject: Re: [PATCH 1/1] imx8: cpu: fix warning for cpu_imx_get_temp

Quoted 6 lines

Hi Igor,

Quoted 3 lines · Igor Opaniuk

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.

Are you trying to fix https://patchwork.ozlabs.org/patch/1095430/ ?

Thanks,
Peng

Quoted 46 lines
Quoted 11 lines

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

Quoted 25 lines
Fixes 82467cb217 ("imx8: cpu: get temperature when print cpu desc")
---
 arch/arm/mach-imx/imx8/cpu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-imx/imx8/cpu.c index 12596c6387..616baed7cc 100644

arch/arm/mach-imx/imx8/cpu.c +4 -5
@@ -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
 
Quoted 1 line

arch/arm/mach-imx/imx8/cpu.c int cpu_imx_get_desc(struct udevice *dev, char *buf, int size) · line 615

Quoted 1 line
arch/arm/mach-imx/imx8/cpu.c +0 -0
    snprintf(buf + ret, size - ret, "\n");

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 8 lines
Best regards - Freundliche Grüsse - Meilleures salutations

Senior Development Engineer,
Igor Opaniuk

Toradex AG
Altsagenstrasse 5 | 6048 Horw/Luzern | Switzerland | T: +41 41 500 48
00 (main line)