diff mbox

[U-Boot,v2,05/23] move UL() macro from armv8/mmu.h into common.h

Message ID 1480902750-839-6-git-send-email-andre.przywara@arm.com
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Andre Przywara Dec. 5, 2016, 1:52 a.m. UTC
The UL() macro is pretty useful in sharing constants between assembly
and C files while still being able to specify a type for C.
Move the macro from an armv8 specific header into a common header file
to be able to use it by arm code (for instance) as well.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
---
 arch/arm/include/asm/armv8/mmu.h |  8 --------
 include/common.h                 | 10 +++++++++-
 2 files changed, 9 insertions(+), 9 deletions(-)

Comments

Simon Glass Dec. 5, 2016, 6:25 a.m. UTC | #1
Hi Andre,

On 4 December 2016 at 18:52, Andre Przywara <andre.przywara@arm.com> wrote:
> The UL() macro is pretty useful in sharing constants between assembly
> and C files while still being able to specify a type for C.
> Move the macro from an armv8 specific header into a common header file
> to be able to use it by arm code (for instance) as well.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Reviewed-by: Alexander Graf <agraf@suse.de>
> ---
>  arch/arm/include/asm/armv8/mmu.h |  8 --------
>  include/common.h                 | 10 +++++++++-
>  2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
> index aa0f3c4..e9b4cdb 100644
> --- a/arch/arm/include/asm/armv8/mmu.h
> +++ b/arch/arm/include/asm/armv8/mmu.h
> @@ -8,14 +8,6 @@
>  #ifndef _ASM_ARMV8_MMU_H_
>  #define _ASM_ARMV8_MMU_H_
>
> -#ifdef __ASSEMBLY__
> -#define _AC(X, Y)      X
> -#else
> -#define _AC(X, Y)      (X##Y)
> -#endif
> -
> -#define UL(x)          _AC(x, UL)
> -
>  /***************************************************************/
>  /*
>   * The following definitions are related each other, shoud be
> diff --git a/include/common.h b/include/common.h
> index a8d833b..5fcd5f5 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -15,6 +15,8 @@ typedef volatile unsigned long        vu_long;
>  typedef volatile unsigned short vu_short;
>  typedef volatile unsigned char vu_char;
>
> +#define _AC(X, Y)       (X##Y)
> +
>  #include <config.h>
>  #include <errno.h>
>  #include <asm-offsets.h>
> @@ -936,7 +938,11 @@ int cpu_disable(int nr);
>  int cpu_release(int nr, int argc, char * const argv[]);
>  #endif
>
> -#endif /* __ASSEMBLY__ */
> +#else  /* __ASSEMBLY__ */
> +
> +#define _AC(X, Y)       X

Can you please comment what this macro is for?

> +
> +#endif /* __ASSEMBLY__ */
>
>  #ifdef CONFIG_PPC
>  /*
> @@ -948,6 +954,8 @@ int cpu_release(int nr, int argc, char * const argv[]);
>
>  /* Put only stuff here that the assembler can digest */
>
> +#define UL(x)           _AC(x, UL)
> +
>  #ifdef CONFIG_POST
>  #define CONFIG_HAS_POST
>  #ifndef CONFIG_POST_ALT_LIST
> --
> 2.8.2
>

Regards,
Simon
diff mbox

Patch

diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
index aa0f3c4..e9b4cdb 100644
--- a/arch/arm/include/asm/armv8/mmu.h
+++ b/arch/arm/include/asm/armv8/mmu.h
@@ -8,14 +8,6 @@ 
 #ifndef _ASM_ARMV8_MMU_H_
 #define _ASM_ARMV8_MMU_H_
 
-#ifdef __ASSEMBLY__
-#define _AC(X, Y)	X
-#else
-#define _AC(X, Y)	(X##Y)
-#endif
-
-#define UL(x)		_AC(x, UL)
-
 /***************************************************************/
 /*
  * The following definitions are related each other, shoud be
diff --git a/include/common.h b/include/common.h
index a8d833b..5fcd5f5 100644
--- a/include/common.h
+++ b/include/common.h
@@ -15,6 +15,8 @@  typedef volatile unsigned long	vu_long;
 typedef volatile unsigned short vu_short;
 typedef volatile unsigned char	vu_char;
 
+#define _AC(X, Y)       (X##Y)
+
 #include <config.h>
 #include <errno.h>
 #include <asm-offsets.h>
@@ -936,7 +938,11 @@  int cpu_disable(int nr);
 int cpu_release(int nr, int argc, char * const argv[]);
 #endif
 
-#endif /* __ASSEMBLY__ */
+#else	/* __ASSEMBLY__ */
+
+#define _AC(X, Y)       X
+
+#endif	/* __ASSEMBLY__ */
 
 #ifdef CONFIG_PPC
 /*
@@ -948,6 +954,8 @@  int cpu_release(int nr, int argc, char * const argv[]);
 
 /* Put only stuff here that the assembler can digest */
 
+#define UL(x)           _AC(x, UL)
+
 #ifdef CONFIG_POST
 #define CONFIG_HAS_POST
 #ifndef CONFIG_POST_ALT_LIST