Skip to contentSkip to conversation

Fix mismatched ifdefs

PATCH In review Sanjeev Premi 2 participants 5 messages Aug 17, 2009 – Aug 18, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix mismatched ifdefs

The #endif at end of the file was missing. However, an additional #else ... #endif was causing the compiler to keep going.

The problem was found when compiler started reporting the newly added inline functions were being reported as redeclared by the compiler.

---
 arch/arm/plat-omap/include/mach/cpu.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-omap/include/mach/cpu.h +2 -2
index 11e73d9..4fbc6a9 100644
@@ -317,8 +317,6 @@ IS_OMAP_TYPE(3430, 0x3430)
 #  undef  cpu_is_omap730
 #  define cpu_is_omap730()		1
 # endif
-#endif
-#else
 # if defined(CONFIG_ARCH_OMAP850)
 #  undef  cpu_is_omap850
 #  define cpu_is_omap850()		1
@@ -433,3 +431,5 @@ IS_OMAP_TYPE(3430, 0x3430)
 
 int omap_chip_is(struct omap_chip_id oci);
 void omap2_check_revision(void);
+
+#endif	/* __ASM_ARCH_OMAP_CPU_H */
Signature · 1 line
1.6.2.2
#1 lore raw
Quoted 18 lines · Sanjeev Premi

The #endif at end of the file was missing. However, an additional #else ... #endif was causing the compiler to keep going.

The problem was found when compiler started reporting the newly added inline functions were being reported as redeclared by the compiler.

---
 arch/arm/plat-omap/include/mach/cpu.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-omap/include/mach/cpu.h +0 -0
index 11e73d9..4fbc6a9 100644

arch/arm/plat-omap/include/mach/cpu.h IS_OMAP_TYPE(3430, 0x3430) · line 321

Quoted 5 lines
arch/arm/plat-omap/include/mach/cpu.h +0 -2
@@ -317,8 +317,6 @@ IS_OMAP_TYPE(3430, 0x3430)
 #  undef  cpu_is_omap730
 #  define cpu_is_omap730()		1
 # endif
-#endif
-#else

Hmm, to me it looks like this should remove the second #endif, but keep the #else for the !MULTI_OMAP1 configurations.

arch/arm/plat-omap/include/mach/cpu.h IS_OMAP_TYPE(3430, 0x3430) · line 435

Quoted 9 lines
arch/arm/plat-omap/include/mach/cpu.h +2 -0
 # if defined(CONFIG_ARCH_OMAP850)
 #  undef  cpu_is_omap850
 #  define cpu_is_omap850()		1
@@ -433,3 +431,5 @@ IS_OMAP_TYPE(3430, 0x3430)
 
 int omap_chip_is(struct omap_chip_id oci);
 void omap2_check_revision(void);
+
+#endif	/* __ASM_ARCH_OMAP_CPU_H */

And this should not be needed.

Regards,

Tony

Quoted 7 lines
Signature · 6 lines
1.6.2.2

--
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
#2 lore raw
Quoted 25 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, August 17, 2009 8:15 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Fix mismatched ifdefs

Quoted 8 lines · Sanjeev Premi

The #endif at end of the file was missing. However, an additional #else ... #endif was causing the compiler to keep going.

The problem was found when compiler started reporting the newly added inline functions were being reported as redeclared by the compiler.

Review

Quoted 6 lines
---
 arch/arm/plat-omap/include/mach/cpu.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/cpu.h

Quoted 14 lines

arch/arm/plat-omap/include/mach/cpu.h IS_OMAP_TYPE(3430, 0x3430) · line 321

Quoted 9 lines

index 11e73d9..4fbc6a9 100644

arch/arm/plat-omap/include/mach/cpu.h +0 -2
@@ -317,8 +317,6 @@ IS_OMAP_TYPE(3430, 0x3430)
 #  undef  cpu_is_omap730
 #  define cpu_is_omap730()		1
 # endif
-#endif
-#else

Hmm, to me it looks like this should remove the second #endif, but keep the
#else for the !MULTI_OMAP1 configurations.

[sp] I did the maching as annotated in the snippet below:

#if defined(MULTI_OMAP1)

# if defined(CONFIG_ARCH_OMAP730)
#  undef  cpu_is_omap730
#  define cpu_is_omap730()		is_omap730()
# endif 
# if defined(CONFIG_ARCH_OMAP850)
#  undef  cpu_is_omap850
#  define cpu_is_omap850()		is_omap850()
# endif
#else  /* sp - else for multi-omap1 */
# if defined(CONFIG_ARCH_OMAP730)
#  undef  cpu_is_omap730
#  define cpu_is_omap730()		1
# endif
#endif
#else
  /* sp - seems like needed in the else path of MULTI_OMAP1
   * else the symbol could go undefined.
   */
# if defined(CONFIG_ARCH_OMAP850)
#  undef  cpu_is_omap850
#  define cpu_is_omap850()		1
# endif
#endif
Quoted 11 lines

arch/arm/plat-omap/include/mach/cpu.h IS_OMAP_TYPE(3430, 0x3430) · line 435

Quoted 9 lines
arch/arm/plat-omap/include/mach/cpu.h +2 -0
 # if defined(CONFIG_ARCH_OMAP850)
 #  undef  cpu_is_omap850
 #  define cpu_is_omap850()		1
@@ -433,3 +431,5 @@ IS_OMAP_TYPE(3430, 0x3430)
 
 int omap_chip_is(struct omap_chip_id oci);
 void omap2_check_revision(void);
+
+#endif	/* __ASM_ARCH_OMAP_CPU_H */

And this should not be needed.

[sp] So where does this end:

#ifndef __ASM_ARCH_OMAP_CPU_H
#define __ASM_ARCH_OMAP_CPU_H

I was hitting the problem possibly due to mutiple inclusion of cpu.h

Any static inline function declared at bottom of cpu.h gets the errors like:

arch/arm/plat-omap/include/mach/cpu.h:465: error: redefinition of 'omap3_has_iva' arch/arm/plat-omap/include/mach/cpu.h:465: error: previous definition of 'omap3_has_iva' was here

Quoted 15 lines

Regards,

Tony

Quoted 5 lines
Signature · 4 lines
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe 

linux-omap" in

Quoted 2 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

PATCH 1/1 OMAP: Fix incorrect 730 vs 850 detection (Re: [PATCH] Fix mismatched ifdefs)

Quoted 84 lines · Premi, Sanjeev
Quoted 25 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, August 17, 2009 8:15 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Fix mismatched ifdefs

Quoted 8 lines · Sanjeev Premi

The #endif at end of the file was missing. However, an additional #else ... #endif was causing the compiler to keep going.

The problem was found when compiler started reporting the newly added inline functions were being reported as redeclared by the compiler.

Review

Quoted 6 lines
---
 arch/arm/plat-omap/include/mach/cpu.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/cpu.h

Quoted 14 lines

arch/arm/plat-omap/include/mach/cpu.h IS_OMAP_TYPE(3430, 0x3430) · line 321

Quoted 9 lines

index 11e73d9..4fbc6a9 100644

arch/arm/plat-omap/include/mach/cpu.h +0 -2
@@ -317,8 +317,6 @@ IS_OMAP_TYPE(3430, 0x3430)
 #  undef  cpu_is_omap730
 #  define cpu_is_omap730()		1
 # endif
-#endif
-#else

Hmm, to me it looks like this should remove the second #endif, but keep the
#else for the !MULTI_OMAP1 configurations.

[sp] I did the maching as annotated in the snippet below:

#if defined(MULTI_OMAP1)

# if defined(CONFIG_ARCH_OMAP730)
#  undef  cpu_is_omap730
#  define cpu_is_omap730()		is_omap730()
# endif 
# if defined(CONFIG_ARCH_OMAP850)
#  undef  cpu_is_omap850
#  define cpu_is_omap850()		is_omap850()
# endif
#else  /* sp - else for multi-omap1 */
# if defined(CONFIG_ARCH_OMAP730)
#  undef  cpu_is_omap730
#  define cpu_is_omap730()		1
# endif
#endif
#else
  /* sp - seems like needed in the else path of MULTI_OMAP1
   * else the symbol could go undefined.
   */
# if defined(CONFIG_ARCH_OMAP850)
#  undef  cpu_is_omap850
#  define cpu_is_omap850()		1
# endif
#endif
Quoted 11 lines

arch/arm/plat-omap/include/mach/cpu.h IS_OMAP_TYPE(3430, 0x3430) · line 435

Quoted 9 lines
arch/arm/plat-omap/include/mach/cpu.h +2 -0
 # if defined(CONFIG_ARCH_OMAP850)
 #  undef  cpu_is_omap850
 #  define cpu_is_omap850()		1
@@ -433,3 +431,5 @@ IS_OMAP_TYPE(3430, 0x3430)
 
 int omap_chip_is(struct omap_chip_id oci);
 void omap2_check_revision(void);
+
+#endif	/* __ASM_ARCH_OMAP_CPU_H */

And this should not be needed.

[sp] So where does this end:

#ifndef __ASM_ARCH_OMAP_CPU_H
#define __ASM_ARCH_OMAP_CPU_H

Quoted 6 lines

I was hitting the problem possibly due to mutiple inclusion of cpu.h

Any static inline function declared at bottom of cpu.h gets the errors like:

arch/arm/plat-omap/include/mach/cpu.h:465: error: redefinition of 'omap3_has_iva' arch/arm/plat-omap/include/mach/cpu.h:465: error: previous definition of 'omap3_has_iva' was here

Here's what I think is the right fix to this, the extra endif got introduced with the 850 patch. Removing that is not the right fix still, we just need to remove the special case for 730 as now we need to detect between 730 and 850.

Can please you try the attached patch?

Regards,

Tony

Quoted 1 line

From 751797cca47c9ccb5443190a0f3d82924ee1eaeb Mon Sep 17 00:00:00 2001

From: Tony Lindgren <[email protected]>
Date: Tue, 18 Aug 2009 12:57:06 +0300
Subject: [PATCH] OMAP: Fix incorrect 730 vs 850 detection

Commit ae302f40 introduced support for omap850 but had a bug in ifdef handling of the non-multi-omap case for 730 and 850.

Fix the problem by removing the non-multi-omap special handling, as we need to detect between omap730 and omap850 anyways.

Problem reported by Sanjeev Premi <[email protected]>.

arch/arm/plat-omap/include/mach/cpu.h +12 -23
index 11e73d9..61dbe90 100644
@@ -303,32 +303,21 @@ IS_OMAP_TYPE(3430, 0x3430)
 #define cpu_is_omap2430()		0
 #define cpu_is_omap3430()		0
 
-#if defined(MULTI_OMAP1)
-# if defined(CONFIG_ARCH_OMAP730)
-#  undef  cpu_is_omap730
-#  define cpu_is_omap730()		is_omap730()
-# endif
-# if defined(CONFIG_ARCH_OMAP850)
-#  undef  cpu_is_omap850
-#  define cpu_is_omap850()		is_omap850()
-# endif
-#else
-# if defined(CONFIG_ARCH_OMAP730)
-#  undef  cpu_is_omap730
-#  define cpu_is_omap730()		1
-# endif
-#endif
-#else
-# if defined(CONFIG_ARCH_OMAP850)
-#  undef  cpu_is_omap850
-#  define cpu_is_omap850()		1
-# endif
-#endif
-
 /*
  * Whether we have MULTI_OMAP1 or not, we still need to distinguish
- * between 330 vs. 1510 and 1611B/5912 vs. 1710.
+ * between 730 vs 850, 330 vs. 1510 and 1611B/5912 vs. 1710.
  */
+
+#if defined(CONFIG_ARCH_OMAP730)
+# undef  cpu_is_omap730
+# define cpu_is_omap730()		is_omap730()
+#endif
+
+#if defined(CONFIG_ARCH_OMAP850)
+# undef  cpu_is_omap850
+# define cpu_is_omap850()		is_omap850()
+#endif
+
 #if defined(CONFIG_ARCH_OMAP15XX)
 # undef  cpu_is_omap310
 # undef  cpu_is_omap1510
#4 lore raw

RE: [PATCH] OMAP: Fix incorrect 730 vs 850 detection (Re: [PATCH] Fix mismatched ifdefs)

Quoted 104 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Tony Lindgren
Sent: Tuesday, August 18, 2009 3:30 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: [PATCH] OMAP: Fix incorrect 730 vs 850 detection (Re: [PATCH] Fix mismatched ifdefs)

Quoted 79 lines · Premi, Sanjeev
Quoted 25 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, August 17, 2009 8:15 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Fix mismatched ifdefs

Quoted 8 lines · Sanjeev Premi

The #endif at end of the file was missing. However, an additional #else ... #endif was causing the compiler to keep going.

The problem was found when compiler started reporting the newly added inline functions were being reported as redeclared by the compiler.

Review

Quoted 6 lines
---
 arch/arm/plat-omap/include/mach/cpu.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/plat-omap/include/mach/cpu.h

Quoted 14 lines

arch/arm/plat-omap/include/mach/cpu.h IS_OMAP_TYPE(3430, 0x3430) · line 321

Quoted 9 lines

index 11e73d9..4fbc6a9 100644

arch/arm/plat-omap/include/mach/cpu.h +0 -2
@@ -317,8 +317,6 @@ IS_OMAP_TYPE(3430, 0x3430)
 #  undef  cpu_is_omap730
 #  define cpu_is_omap730()		1
 # endif
-#endif
-#else

Hmm, to me it looks like this should remove the second #endif, but keep the
#else for the !MULTI_OMAP1 configurations.

[sp] I did the maching as annotated in the snippet below:

#if defined(MULTI_OMAP1)

# if defined(CONFIG_ARCH_OMAP730)
#  undef  cpu_is_omap730
#  define cpu_is_omap730()		is_omap730()
# endif 
# if defined(CONFIG_ARCH_OMAP850)
#  undef  cpu_is_omap850
#  define cpu_is_omap850()		is_omap850()
# endif
#else  /* sp - else for multi-omap1 */
# if defined(CONFIG_ARCH_OMAP730)
#  undef  cpu_is_omap730
#  define cpu_is_omap730()		1
# endif
#endif
#else
  /* sp - seems like needed in the else path of MULTI_OMAP1
   * else the symbol could go undefined.
   */
# if defined(CONFIG_ARCH_OMAP850)
#  undef  cpu_is_omap850
#  define cpu_is_omap850()		1
# endif
#endif
Quoted 11 lines

arch/arm/plat-omap/include/mach/cpu.h IS_OMAP_TYPE(3430, 0x3430) · line 435

Quoted 9 lines
arch/arm/plat-omap/include/mach/cpu.h +2 -0
 # if defined(CONFIG_ARCH_OMAP850)
 #  undef  cpu_is_omap850
 #  define cpu_is_omap850()		1
@@ -433,3 +431,5 @@ IS_OMAP_TYPE(3430, 0x3430)
 
 int omap_chip_is(struct omap_chip_id oci);
 void omap2_check_revision(void);
+
+#endif	/* __ASM_ARCH_OMAP_CPU_H */

And this should not be needed.

Quoted 8 lines

[sp] So where does this end:

#ifndef __ASM_ARCH_OMAP_CPU_H
#define __ASM_ARCH_OMAP_CPU_H

I was hitting the problem possibly due to mutiple inclusion of cpu.h

Any static inline function declared at bottom of cpu.h gets

the errors like:

Quoted 2 lines

arch/arm/plat-omap/include/mach/cpu.h:465: error:

redefinition of 'omap3_has_iva'

Quoted 1 line

arch/arm/plat-omap/include/mach/cpu.h:465: error: previous

definition of 'omap3_has_iva' was here

Quoted 9 lines

Here's what I think is the right fix to this, the extra endif got introduced
with the 850 patch. Removing that is not the right fix still, we just need to
remove the special case for 730 as now we need to detect between 730 and 850.

Can please you try the attached patch?

Tony,

This patch is able to match the ifdefs locally where the OMAP5730 and OMAP850 is being done. However, the #ifndef in the beginning of the files is still not terminated.

I mentioned this yesterday as well...

Here is the snippet compiler error:

                 from include/linux/interrupt.h:12,
                 from include/linux/kernel_stat.h:8,
                 from init/main.c:33:

arch/arm/plat-omap/include/mach/cpu.h:30:1: error: unterminated #ifndef make[1]: *** [init/main.o] Error 1

The file needs an endif at bottom

#endif /* __ASM_ARCH_OMAP_CPU_H */

Best regards,
Sanjeev

Quoted 4 lines

Regards,

Tony