[PATCH 4/6] ARM: mxc: don't allow to compile together i.MX51 and i.MX53

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Tue Apr 12 05:54:46 EDT 2011


Hello,

On Mon, Apr 11, 2011 at 10:15:09AM -0400, Nicolas Pitre wrote:
> On Mon, 11 Apr 2011, Uwe Kleine-König wrote:
> > Currently you can build a
> > kernel for i.MX51 + i.MX53 but IIRC it works on no machine.
> 
> Maybe it should be fixed?
To catch similar errors earlier next time, I'd like the compiler to wail
if the physoffsets don't match (in the !ARM_PATCH_PHYS_VIRT case).

The best thing I could come up with up to now is:

#if !defined(CONFIG_ARM_PATCH_PHYS_VIRT)
# if defined CONFIG_ARCH_MX1
#  define PLAT_PHYS_OFFSET              MX1_PHYS_OFFSET
# endif
# if defined CONFIG_MACH_MX21 && (!defined(PLAT_PHYS_OFFSET) || PLAT_PHYS_OFFSET != MX21_PHYS_OFFSET)
#  define PLAT_PHYS_OFFSET              MX21_PHYS_OFFSET
# endif
# if defined CONFIG_ARCH_MX25 && (!defined(PLAT_PHYS_OFFSET) || PLAT_PHYS_OFFSET != MX25_PHYS_OFFSET)
#  define PLAT_PHYS_OFFSET              MX25_PHYS_OFFSET
# endif
...

this is really ugly.  And even to make this work I have to do 

diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 431077c..957cd7e 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -16,8 +16,6 @@
 #include <linux/compiler.h>
 #include <linux/const.h>
 #include <linux/types.h>
-#include <mach/memory.h>
-#include <asm/sizes.h>
 
 /*
  * Allow for constants defined here to be used from assembly code
@@ -25,6 +23,9 @@
  */
 #define UL(x) _AC(x, UL)
 
+#include <mach/memory.h>
+#include <asm/sizes.h>
+
 #ifdef CONFIG_MMU
 
 /*

because cpp can only compare integers and so needs a definition for UL.
Even when keeping the definition as it is now (i.e. asserting a single
definition by using #ifelse) adding something like:

#if defined(PLAT_PHYS_OFFSET)
# if defined(CONFIG_ARCH_MX1) && (PLAT_PHYS_OFFSET != MX1_PHYS_OFFSET)
#error something
# endif
# ...
#endif

needs the UL macro.

Does someone has a better idea? If not it's probably not worth the change.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the linux-arm-kernel mailing list