Skip to contentSkip to conversation

OMAP: PM: CPUFREQ: Fix conditional compilation

PATCH Superseded Silesh C V 4 participants 7 messages Sep 24, 2010 – Sep 29, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Silesh C V

author
#0 lore raw

PATCH 1/1 OMAP: PM: CPUFREQ: Fix conditional compilation

Fix conditional compilation.

---

Applies on top of the latest pm branch.

 arch/arm/plat-omap/cpu-omap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-omap/cpu-omap.c +1 -1
index df08829..02e4865 100644
@@ -41,7 +41,7 @@ static struct cpufreq_frequency_table *freq_table;
 
 #ifdef CONFIG_ARCH_OMAP1
 #define MPU_CLK		"mpu"
-#elif CONFIG_ARCH_OMAP3
+#elif defined(CONFIG_ARCH_OMAP3)
 #define MPU_CLK		"arm_fck"
 #else
 #define MPU_CLK		"virt_prcm_set"
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 1 line · Silesh C V

Fix conditional compilation.

What excatly was the compile error? and with which compiler?

The current pm branch seems to compile fine for me.

Kevin

Quoted 21 lines

---

Applies on top of the latest pm branch.

 arch/arm/plat-omap/cpu-omap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-omap/cpu-omap.c +1 -1
index df08829..02e4865 100644
@@ -41,7 +41,7 @@ static struct cpufreq_frequency_table *freq_table;
 
 #ifdef CONFIG_ARCH_OMAP1
 #define MPU_CLK		"mpu"
-#elif CONFIG_ARCH_OMAP3
+#elif defined(CONFIG_ARCH_OMAP3)
 #define MPU_CLK		"arm_fck"
 #else
 #define MPU_CLK		"virt_prcm_set"
author
#2 lore raw
Quoted 5 lines · Kevin Hilman
Quoted 1 line · Silesh C V

Fix conditional compilation.

What excatly was the compile error?  and with which compiler?

There is no compiler error.But what we need after an #elif is a conditional expression.
The correct usage is #elif defined(CONFIG_XXX) rather than #elif CONFIG_XXX.

Further, if the kernel is configured for a non-omap3 arch (eg.OMAP4), you get a compiler warning:
arch/arm/plat-omap/cpu-omap.c:47:7: warning: "CONFIG_ARCH_OMAP3" is not defined which goes away with this patch.

Quoted 5 lines

The current pm branch  seems to compile fine for me.

Kevin

Thanks,
Silesh.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 8 lines · Silesh C V
Quoted 5 lines · Kevin Hilman
Quoted 1 line · Silesh C V

Fix conditional compilation.

What excatly was the compile error?  and with which compiler?

Quoted 9 lines

There is no compiler error.But what we need after an #elif is a conditional expression.
The correct usage is #elif defined(CONFIG_XXX) rather than #elif CONFIG_XXX.

Further, if the kernel is configured for a non-omap3 arch (eg.OMAP4), you get a compiler warning:
arch/arm/plat-omap/cpu-omap.c:47:7: warning: "CONFIG_ARCH_OMAP3" is not defined which goes away with this patch.

Silesh,

which defconfig are you using with multi omap-build defconfig(omap3_defconfig)

CONFIG_ARCH_OMAP3 will be enabled. So this compilation error will not occur.

---
Regards,
Govindraj.R

Quoted 6 lines
Quoted 5 lines

The current pm branch  seems to compile fine for me.

Kevin

Quoted 7 lines

Thanks,
Silesh.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 21 lines · Govindraj
Quoted 8 lines · Silesh C V
Quoted 5 lines · Kevin Hilman
Quoted 1 line · Silesh C V

Fix conditional compilation.

What excatly was the compile error?  and with which compiler?

Quoted 9 lines

There is no compiler error.But what we need after an #elif is a conditional expression.
The correct usage is #elif defined(CONFIG_XXX) rather than #elif CONFIG_XXX.

Further, if the kernel is configured for a non-omap3 arch (eg.OMAP4), you get a compiler warning:
arch/arm/plat-omap/cpu-omap.c:47:7: warning: "CONFIG_ARCH_OMAP3" is not defined which goes away with this patch.

Silesh,

Quoted 9 lines

which defconfig are you using with multi omap-build defconfig(omap3_defconfig)

CONFIG_ARCH_OMAP3 will be enabled. So this compilation error will not occur.

---
Regards,
Govindraj.R

As I said before there is no compilation error. But what we have to check for is whether CONFIG_ARCH_OMAP3 is defined or not. Not for the value of CONFIG_ARCH_OMAP3. We have to check for value of defined (CONFIG_ARCH_OMAP3). Otherwise compiler searches for the value of the macro and hence the warning(comes with a omap4 config).See how #elif + CONFIG_XXX is used elsewhere in kernel.

Thanks,
Silesh.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
Quoted 32 lines · Silesh C V
Quoted 21 lines · Govindraj
Quoted 8 lines · Silesh C V
Quoted 5 lines · Kevin Hilman
Quoted 1 line · Silesh C V

Fix conditional compilation.

What excatly was the compile error?  and with which compiler?

Quoted 9 lines

There is no compiler error.But what we need after an #elif is a conditional expression.
The correct usage is #elif defined(CONFIG_XXX) rather than #elif CONFIG_XXX.

Further, if the kernel is configured for a non-omap3 arch (eg.OMAP4), you get a compiler warning:
arch/arm/plat-omap/cpu-omap.c:47:7: warning: "CONFIG_ARCH_OMAP3" is not defined which goes away with this patch.

Silesh,

Quoted 9 lines

which defconfig are you using with multi omap-build defconfig(omap3_defconfig)

CONFIG_ARCH_OMAP3 will be enabled. So this compilation error will not occur.

---
Regards,
Govindraj.R

Quoted 6 lines

As I said before there is no compilation error. But what we have to check for is whether CONFIG_ARCH_OMAP3 is defined or not. Not for the value of CONFIG_ARCH_OMAP3. We have to check for value of defined (CONFIG_ARCH_OMAP3). Otherwise compiler searches for the value of the macro and hence the warning(comes with a omap4 config).See how #elif + CONFIG_XXX is used elsewhere in kernel.

I see what you're saying now. The current #elif clause will *always* be true.

You'll notice that all of this confusion would not have happened if the original changelog described the problem in detail, showing that that #elif clause will always be true, and especially not calling it a compliation fix.

Please re-post with a better changelog and I will incoporate into the pm-cpufreq sub-branch of the PM branch.

Thanks,

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#6 lore raw
Quoted 7 lines · Kevin Hilman

I see what you're saying now.  The current #elif clause will *always* be true.

You'll notice that all of this confusion would not have happened if the original changelog described the problem in detail, showing that that #elif clause will always be true, and especially not calling it a compliation fix.

I did not call it a compilation fix, I called it a _conditional_ compilation fix ;-).
The problem is not that the #elif clause ends up always being true. The problem is that the preprocessor checks for the value of CONFIG_ARCH_OMAP3 rather than the value of defined(CONFIG_ARCH_OMAP3). Hence it emits warnings when CONFIG_ARCH_OMAP3 is not defined making the #elif clause useless(which is there to check whether the macro is defined or not).

Quoted 3 lines

Please re-post with a better changelog and I will incoporate into the pm-cpufreq sub-branch of the PM branch.

Will do.

Thanks,
Silesh
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html