Patchwork [U-Boot,v2,1/7] ARM: prepare armv7.h to be included from assembly source

login
register
mail settings
Submitter Andre Przywara
Date June 13, 2013, 11:01 a.m.
Message ID <1371121273-18763-2-git-send-email-andre.przywara@linaro.org>
Download mbox | patch
Permalink /patch/251049/
State Superseded
Delegated to: Albert ARIBAUD
Headers show

Comments

Andre Przywara - June 13, 2013, 11:01 a.m.
armv7.h contains some useful constants, but also C prototypes.
To include it also in assembly files, protect the non-assembly
part appropriately.

Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
---
 arch/arm/include/asm/armv7.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Masahiro Yamada - June 28, 2013, 1 a.m.
Hello Andre,

> diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h
> index a73630b..20caa7c 100644
> --- a/arch/arm/include/asm/armv7.h
> +++ b/arch/arm/include/asm/armv7.h
> @@ -23,7 +23,6 @@
>   */
>  #ifndef ARMV7_H
>  #define ARMV7_H
> -#include <linux/types.h>
>  
>  /* Cortex-A9 revisions */
>  #define MIDR_CORTEX_A9_R0P1	0x410FC091
> @@ -57,6 +56,9 @@
>  #define ARMV7_CLIDR_CTYPE_INSTRUCTION_DATA	3
>  #define ARMV7_CLIDR_CTYPE_UNIFIED		4
>  
> +#ifndef __ASSEMBLY__
> +#include <linux/types.h>
> +
>  /*
>   * CP15 Barrier instructions
>   * Please note that we have separate barrier instructions in ARMv7
> @@ -74,4 +76,6 @@ void v7_outer_cache_inval_all(void);
>  void v7_outer_cache_flush_range(u32 start, u32 end);
>  void v7_outer_cache_inval_range(u32 start, u32 end);
>  
> +#endif /* ! __ASSEMBLY__ */
> +
>  #endif


Instread of moving #include <linux/types.h> line,
I'd like to suggest to add #ifndef __ASSEMBLY__ guard
to include/linux/types.h.
I think this is a more correct way of fixing.


If I see Linux Kernel "include/linux/types.h",
typedefs are placed inside #ifndef  __ASSEMBLEY__ .. #endif.

On the other hand, "include/linux/types.h" of U-Boot
does not have #ifndef __ASSEMBLY__ guard.



Best Regards
Masahiro Yamada
Andre Przywara - July 4, 2013, 7:38 a.m.
On 06/28/2013 03:00 AM, Masahiro Yamada wrote:
> Hello Andre,

Hi,

thanks a lot for the review! I included most of the fixes you proposed
in the next version I will send out soon.
Very useful comments, thanks again!

>> diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h
>> index a73630b..20caa7c 100644
>> --- a/arch/arm/include/asm/armv7.h
>> +++ b/arch/arm/include/asm/armv7.h
>> @@ -23,7 +23,6 @@
>>    */
>>   #ifndef ARMV7_H
>>   #define ARMV7_H
>> -#include <linux/types.h>
>>   
>>   /* Cortex-A9 revisions */
>>   #define MIDR_CORTEX_A9_R0P1	0x410FC091
>> @@ -57,6 +56,9 @@
>>   #define ARMV7_CLIDR_CTYPE_INSTRUCTION_DATA	3
>>   #define ARMV7_CLIDR_CTYPE_UNIFIED		4
>>   
>> +#ifndef __ASSEMBLY__
>> +#include <linux/types.h>
>> +
>>   /*
>>    * CP15 Barrier instructions
>>    * Please note that we have separate barrier instructions in ARMv7
>> @@ -74,4 +76,6 @@ void v7_outer_cache_inval_all(void);
>>   void v7_outer_cache_flush_range(u32 start, u32 end);
>>   void v7_outer_cache_inval_range(u32 start, u32 end);
>>   
>> +#endif /* ! __ASSEMBLY__ */
>> +
>>   #endif
> 
> 
> Instread of moving #include <linux/types.h> line,
> I'd like to suggest to add #ifndef __ASSEMBLY__ guard
> to include/linux/types.h.
> I think this is a more correct way of fixing.
> 
> 
> If I see Linux Kernel "include/linux/types.h",
> typedefs are placed inside #ifndef  __ASSEMBLEY__ .. #endif.
> 
> On the other hand, "include/linux/types.h" of U-Boot
> does not have #ifndef __ASSEMBLY__ guard.

I tried, but finally decided against it. It is not clear what parts of
types.h are actually usable from assembly files, so I stuck with my
solution. Feel free to send a follow-up patch if you think it's useful.

Regards,
Andre.

Patch

diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h
index a73630b..20caa7c 100644
--- a/arch/arm/include/asm/armv7.h
+++ b/arch/arm/include/asm/armv7.h
@@ -23,7 +23,6 @@ 
  */
 #ifndef ARMV7_H
 #define ARMV7_H
-#include <linux/types.h>
 
 /* Cortex-A9 revisions */
 #define MIDR_CORTEX_A9_R0P1	0x410FC091
@@ -57,6 +56,9 @@ 
 #define ARMV7_CLIDR_CTYPE_INSTRUCTION_DATA	3
 #define ARMV7_CLIDR_CTYPE_UNIFIED		4
 
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+
 /*
  * CP15 Barrier instructions
  * Please note that we have separate barrier instructions in ARMv7
@@ -74,4 +76,6 @@  void v7_outer_cache_inval_all(void);
 void v7_outer_cache_flush_range(u32 start, u32 end);
 void v7_outer_cache_inval_range(u32 start, u32 end);
 
+#endif /* ! __ASSEMBLY__ */
+
 #endif