[PATCH 13/41] hexagon: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers

Thomas Huth posted 41 patches 9 months, 1 week ago
There is a newer version of this series
[PATCH 13/41] hexagon: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers
Posted by Thomas Huth 9 months, 1 week ago
While the GCC and Clang compilers already define __ASSEMBLER__
automatically when compiling assembly code, __ASSEMBLY__ is a
macro that only gets defined by the Makefiles in the kernel.
This can be very confusing when switching between userspace
and kernelspace coding, or when dealing with uapi headers that
rather should use __ASSEMBLER__ instead. So let's standardize on
the __ASSEMBLER__ macro that is provided by the compilers now.

This is a completely mechanical patch (done with a simple "sed -i"
statement).

Cc: Brian Cain <brian.cain@oss.qualcomm.com>
Cc: linux-hexagon@vger.kernel.org
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 arch/hexagon/include/asm/hexagon_vm.h  |  4 ++--
 arch/hexagon/include/asm/mem-layout.h  |  6 +++---
 arch/hexagon/include/asm/page.h        |  4 ++--
 arch/hexagon/include/asm/processor.h   |  4 ++--
 arch/hexagon/include/asm/thread_info.h | 12 ++++++------
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/arch/hexagon/include/asm/hexagon_vm.h b/arch/hexagon/include/asm/hexagon_vm.h
index 9aa2493fe7863..e1e702eb9e12a 100644
--- a/arch/hexagon/include/asm/hexagon_vm.h
+++ b/arch/hexagon/include/asm/hexagon_vm.h
@@ -39,7 +39,7 @@
 #define HVM_TRAP1_VMGETREGS		22
 #define HVM_TRAP1_VMTIMEROP		24
 
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 
 enum VM_CACHE_OPS {
 	hvmc_ickill,
@@ -178,7 +178,7 @@ static inline long __vmintop_clear(long i)
 
 #else /* Only assembly code should reference these */
 
-#endif /* __ASSEMBLY__ */
+#endif /* __ASSEMBLER__ */
 
 /*
  * Constants for virtual instruction parameters and return values
diff --git a/arch/hexagon/include/asm/mem-layout.h b/arch/hexagon/include/asm/mem-layout.h
index e2f99413fe56e..8bad920d8928a 100644
--- a/arch/hexagon/include/asm/mem-layout.h
+++ b/arch/hexagon/include/asm/mem-layout.h
@@ -25,7 +25,7 @@
  */
 
 #ifdef CONFIG_HEXAGON_PHYS_OFFSET
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 extern unsigned long	__phys_offset;
 #endif
 #define PHYS_OFFSET	__phys_offset
@@ -44,7 +44,7 @@ extern unsigned long	__phys_offset;
 #define STACK_TOP			TASK_SIZE
 #define STACK_TOP_MAX			TASK_SIZE
 
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 enum fixed_addresses {
 	FIX_KMAP_BEGIN,
 	FIX_KMAP_END,  /*  check for per-cpuism  */
@@ -101,7 +101,7 @@ extern int max_kernel_seg;
  * and pkmap_base begins.
  */
 #define VMALLOC_END (PKMAP_BASE-PAGE_SIZE*2)
-#endif /*  !__ASSEMBLY__  */
+#endif /*  !__ASSEMBLER__  */
 
 
 #endif /* _ASM_HEXAGON_MEM_LAYOUT_H */
diff --git a/arch/hexagon/include/asm/page.h b/arch/hexagon/include/asm/page.h
index 137ba7c5de481..7e651428a08c0 100644
--- a/arch/hexagon/include/asm/page.h
+++ b/arch/hexagon/include/asm/page.h
@@ -48,7 +48,7 @@
 #include <vdso/page.h>
 
 #ifdef __KERNEL__
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 
 /*
  * This is for PFN_DOWN, which mm.h needs.  Seems the right place to pull it in.
@@ -128,7 +128,7 @@ static inline unsigned long virt_to_pfn(const void *kaddr)
 /* XXX Todo: implement assembly-optimized version of getorder. */
 #include <asm-generic/getorder.h>
 
-#endif /* ifdef __ASSEMBLY__ */
+#endif /* ifdef __ASSEMBLER__ */
 #endif /* ifdef __KERNEL__ */
 
 #endif
diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h
index 0cd39c2cdf8f7..b93c2cc4be22e 100644
--- a/arch/hexagon/include/asm/processor.h
+++ b/arch/hexagon/include/asm/processor.h
@@ -8,7 +8,7 @@
 #ifndef _ASM_PROCESSOR_H
 #define _ASM_PROCESSOR_H
 
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 
 #include <asm/mem-layout.h>
 #include <asm/registers.h>
@@ -124,6 +124,6 @@ struct hexagon_switch_stack {
 	unsigned long		lr;
 };
 
-#endif /* !__ASSEMBLY__ */
+#endif /* !__ASSEMBLER__ */
 
 #endif
diff --git a/arch/hexagon/include/asm/thread_info.h b/arch/hexagon/include/asm/thread_info.h
index e90f280b9ce3e..a0da6c694c87b 100644
--- a/arch/hexagon/include/asm/thread_info.h
+++ b/arch/hexagon/include/asm/thread_info.h
@@ -10,7 +10,7 @@
 
 #ifdef __KERNEL__
 
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 #include <asm/processor.h>
 #include <asm/registers.h>
 #include <asm/page.h>
@@ -20,7 +20,7 @@
 #define THREAD_SIZE		(1<<THREAD_SHIFT)
 #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
 
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 
 /*
  * This is union'd with the "bottom" of the kernel stack.
@@ -47,13 +47,13 @@ struct thread_info {
 	unsigned long		sp;
 };
 
-#else /* !__ASSEMBLY__ */
+#else /* !__ASSEMBLER__ */
 
 #include <asm/asm-offsets.h>
 
-#endif  /* __ASSEMBLY__  */
+#endif  /* __ASSEMBLER__  */
 
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 
 #define INIT_THREAD_INFO(tsk)                   \
 {                                               \
@@ -73,7 +73,7 @@ struct thread_info {
 register struct thread_info *__current_thread_info asm(QUOTED_THREADINFO_REG);
 #define current_thread_info()  __current_thread_info
 
-#endif /* __ASSEMBLY__ */
+#endif /* __ASSEMBLER__ */
 
 /*
  * thread information flags
-- 
2.48.1
Re: [PATCH 13/41] hexagon: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers
Posted by Brian Cain 8 months, 1 week ago
On 3/14/2025 2:09 AM, Thomas Huth wrote:
> While the GCC and Clang compilers already define __ASSEMBLER__
> automatically when compiling assembly code, __ASSEMBLY__ is a
> macro that only gets defined by the Makefiles in the kernel.
> This can be very confusing when switching between userspace
> and kernelspace coding, or when dealing with uapi headers that
> rather should use __ASSEMBLER__ instead. So let's standardize on
> the __ASSEMBLER__ macro that is provided by the compilers now.
>
> This is a completely mechanical patch (done with a simple "sed -i"
> statement).
>
> Cc: Brian Cain <brian.cain@oss.qualcomm.com>
> Cc: linux-hexagon@vger.kernel.org
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---


Acked-by: Brian Cain <brian.cain@oss.qualcomm.com>


>   arch/hexagon/include/asm/hexagon_vm.h  |  4 ++--
>   arch/hexagon/include/asm/mem-layout.h  |  6 +++---
>   arch/hexagon/include/asm/page.h        |  4 ++--
>   arch/hexagon/include/asm/processor.h   |  4 ++--
>   arch/hexagon/include/asm/thread_info.h | 12 ++++++------
>   5 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/arch/hexagon/include/asm/hexagon_vm.h b/arch/hexagon/include/asm/hexagon_vm.h
> index 9aa2493fe7863..e1e702eb9e12a 100644
> --- a/arch/hexagon/include/asm/hexagon_vm.h
> +++ b/arch/hexagon/include/asm/hexagon_vm.h
> @@ -39,7 +39,7 @@
>   #define HVM_TRAP1_VMGETREGS		22
>   #define HVM_TRAP1_VMTIMEROP		24
>   
> -#ifndef __ASSEMBLY__
> +#ifndef __ASSEMBLER__
>   
>   enum VM_CACHE_OPS {
>   	hvmc_ickill,
> @@ -178,7 +178,7 @@ static inline long __vmintop_clear(long i)
>   
>   #else /* Only assembly code should reference these */
>   
> -#endif /* __ASSEMBLY__ */
> +#endif /* __ASSEMBLER__ */
>   
>   /*
>    * Constants for virtual instruction parameters and return values
> diff --git a/arch/hexagon/include/asm/mem-layout.h b/arch/hexagon/include/asm/mem-layout.h
> index e2f99413fe56e..8bad920d8928a 100644
> --- a/arch/hexagon/include/asm/mem-layout.h
> +++ b/arch/hexagon/include/asm/mem-layout.h
> @@ -25,7 +25,7 @@
>    */
>   
>   #ifdef CONFIG_HEXAGON_PHYS_OFFSET
> -#ifndef __ASSEMBLY__
> +#ifndef __ASSEMBLER__
>   extern unsigned long	__phys_offset;
>   #endif
>   #define PHYS_OFFSET	__phys_offset
> @@ -44,7 +44,7 @@ extern unsigned long	__phys_offset;
>   #define STACK_TOP			TASK_SIZE
>   #define STACK_TOP_MAX			TASK_SIZE
>   
> -#ifndef __ASSEMBLY__
> +#ifndef __ASSEMBLER__
>   enum fixed_addresses {
>   	FIX_KMAP_BEGIN,
>   	FIX_KMAP_END,  /*  check for per-cpuism  */
> @@ -101,7 +101,7 @@ extern int max_kernel_seg;
>    * and pkmap_base begins.
>    */
>   #define VMALLOC_END (PKMAP_BASE-PAGE_SIZE*2)
> -#endif /*  !__ASSEMBLY__  */
> +#endif /*  !__ASSEMBLER__  */
>   
>   
>   #endif /* _ASM_HEXAGON_MEM_LAYOUT_H */
> diff --git a/arch/hexagon/include/asm/page.h b/arch/hexagon/include/asm/page.h
> index 137ba7c5de481..7e651428a08c0 100644
> --- a/arch/hexagon/include/asm/page.h
> +++ b/arch/hexagon/include/asm/page.h
> @@ -48,7 +48,7 @@
>   #include <vdso/page.h>
>   
>   #ifdef __KERNEL__
> -#ifndef __ASSEMBLY__
> +#ifndef __ASSEMBLER__
>   
>   /*
>    * This is for PFN_DOWN, which mm.h needs.  Seems the right place to pull it in.
> @@ -128,7 +128,7 @@ static inline unsigned long virt_to_pfn(const void *kaddr)
>   /* XXX Todo: implement assembly-optimized version of getorder. */
>   #include <asm-generic/getorder.h>
>   
> -#endif /* ifdef __ASSEMBLY__ */
> +#endif /* ifdef __ASSEMBLER__ */
>   #endif /* ifdef __KERNEL__ */
>   
>   #endif
> diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h
> index 0cd39c2cdf8f7..b93c2cc4be22e 100644
> --- a/arch/hexagon/include/asm/processor.h
> +++ b/arch/hexagon/include/asm/processor.h
> @@ -8,7 +8,7 @@
>   #ifndef _ASM_PROCESSOR_H
>   #define _ASM_PROCESSOR_H
>   
> -#ifndef __ASSEMBLY__
> +#ifndef __ASSEMBLER__
>   
>   #include <asm/mem-layout.h>
>   #include <asm/registers.h>
> @@ -124,6 +124,6 @@ struct hexagon_switch_stack {
>   	unsigned long		lr;
>   };
>   
> -#endif /* !__ASSEMBLY__ */
> +#endif /* !__ASSEMBLER__ */
>   
>   #endif
> diff --git a/arch/hexagon/include/asm/thread_info.h b/arch/hexagon/include/asm/thread_info.h
> index e90f280b9ce3e..a0da6c694c87b 100644
> --- a/arch/hexagon/include/asm/thread_info.h
> +++ b/arch/hexagon/include/asm/thread_info.h
> @@ -10,7 +10,7 @@
>   
>   #ifdef __KERNEL__
>   
> -#ifndef __ASSEMBLY__
> +#ifndef __ASSEMBLER__
>   #include <asm/processor.h>
>   #include <asm/registers.h>
>   #include <asm/page.h>
> @@ -20,7 +20,7 @@
>   #define THREAD_SIZE		(1<<THREAD_SHIFT)
>   #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
>   
> -#ifndef __ASSEMBLY__
> +#ifndef __ASSEMBLER__
>   
>   /*
>    * This is union'd with the "bottom" of the kernel stack.
> @@ -47,13 +47,13 @@ struct thread_info {
>   	unsigned long		sp;
>   };
>   
> -#else /* !__ASSEMBLY__ */
> +#else /* !__ASSEMBLER__ */
>   
>   #include <asm/asm-offsets.h>
>   
> -#endif  /* __ASSEMBLY__  */
> +#endif  /* __ASSEMBLER__  */
>   
> -#ifndef __ASSEMBLY__
> +#ifndef __ASSEMBLER__
>   
>   #define INIT_THREAD_INFO(tsk)                   \
>   {                                               \
> @@ -73,7 +73,7 @@ struct thread_info {
>   register struct thread_info *__current_thread_info asm(QUOTED_THREADINFO_REG);
>   #define current_thread_info()  __current_thread_info
>   
> -#endif /* __ASSEMBLY__ */
> +#endif /* __ASSEMBLER__ */
>   
>   /*
>    * thread information flags
Re: [PATCH 13/41] hexagon: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers
Posted by Thomas Huth 2 months, 1 week ago
On 08/04/2025 17.16, Brian Cain wrote:
> 
> On 3/14/2025 2:09 AM, Thomas Huth wrote:
>> While the GCC and Clang compilers already define __ASSEMBLER__
>> automatically when compiling assembly code, __ASSEMBLY__ is a
>> macro that only gets defined by the Makefiles in the kernel.
>> This can be very confusing when switching between userspace
>> and kernelspace coding, or when dealing with uapi headers that
>> rather should use __ASSEMBLER__ instead. So let's standardize on
>> the __ASSEMBLER__ macro that is provided by the compilers now.
>>
>> This is a completely mechanical patch (done with a simple "sed -i"
>> statement).
>>
>> Cc: Brian Cain <brian.cain@oss.qualcomm.com>
>> Cc: linux-hexagon@vger.kernel.org
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
> 
> 
> Acked-by: Brian Cain <brian.cain@oss.qualcomm.com>

  Hi Brian!

Could you please merge the two hexagon patches through the hexagon tree? 
(most of the patches for the other architectures have also been picked up by 
the respective architecture maintainers)

  Thanks,
   Thomas


> 
>>   arch/hexagon/include/asm/hexagon_vm.h  |  4 ++--
>>   arch/hexagon/include/asm/mem-layout.h  |  6 +++---
>>   arch/hexagon/include/asm/page.h        |  4 ++--
>>   arch/hexagon/include/asm/processor.h   |  4 ++--
>>   arch/hexagon/include/asm/thread_info.h | 12 ++++++------
>>   5 files changed, 15 insertions(+), 15 deletions(-)
>>
>> diff --git a/arch/hexagon/include/asm/hexagon_vm.h b/arch/hexagon/include/ 
>> asm/hexagon_vm.h
>> index 9aa2493fe7863..e1e702eb9e12a 100644
>> --- a/arch/hexagon/include/asm/hexagon_vm.h
>> +++ b/arch/hexagon/include/asm/hexagon_vm.h
>> @@ -39,7 +39,7 @@
>>   #define HVM_TRAP1_VMGETREGS        22
>>   #define HVM_TRAP1_VMTIMEROP        24
>> -#ifndef __ASSEMBLY__
>> +#ifndef __ASSEMBLER__
>>   enum VM_CACHE_OPS {
>>       hvmc_ickill,
>> @@ -178,7 +178,7 @@ static inline long __vmintop_clear(long i)
>>   #else /* Only assembly code should reference these */
>> -#endif /* __ASSEMBLY__ */
>> +#endif /* __ASSEMBLER__ */
>>   /*
>>    * Constants for virtual instruction parameters and return values
>> diff --git a/arch/hexagon/include/asm/mem-layout.h b/arch/hexagon/include/ 
>> asm/mem-layout.h
>> index e2f99413fe56e..8bad920d8928a 100644
>> --- a/arch/hexagon/include/asm/mem-layout.h
>> +++ b/arch/hexagon/include/asm/mem-layout.h
>> @@ -25,7 +25,7 @@
>>    */
>>   #ifdef CONFIG_HEXAGON_PHYS_OFFSET
>> -#ifndef __ASSEMBLY__
>> +#ifndef __ASSEMBLER__
>>   extern unsigned long    __phys_offset;
>>   #endif
>>   #define PHYS_OFFSET    __phys_offset
>> @@ -44,7 +44,7 @@ extern unsigned long    __phys_offset;
>>   #define STACK_TOP            TASK_SIZE
>>   #define STACK_TOP_MAX            TASK_SIZE
>> -#ifndef __ASSEMBLY__
>> +#ifndef __ASSEMBLER__
>>   enum fixed_addresses {
>>       FIX_KMAP_BEGIN,
>>       FIX_KMAP_END,  /*  check for per-cpuism  */
>> @@ -101,7 +101,7 @@ extern int max_kernel_seg;
>>    * and pkmap_base begins.
>>    */
>>   #define VMALLOC_END (PKMAP_BASE-PAGE_SIZE*2)
>> -#endif /*  !__ASSEMBLY__  */
>> +#endif /*  !__ASSEMBLER__  */
>>   #endif /* _ASM_HEXAGON_MEM_LAYOUT_H */
>> diff --git a/arch/hexagon/include/asm/page.h b/arch/hexagon/include/asm/ 
>> page.h
>> index 137ba7c5de481..7e651428a08c0 100644
>> --- a/arch/hexagon/include/asm/page.h
>> +++ b/arch/hexagon/include/asm/page.h
>> @@ -48,7 +48,7 @@
>>   #include <vdso/page.h>
>>   #ifdef __KERNEL__
>> -#ifndef __ASSEMBLY__
>> +#ifndef __ASSEMBLER__
>>   /*
>>    * This is for PFN_DOWN, which mm.h needs.  Seems the right place to 
>> pull it in.
>> @@ -128,7 +128,7 @@ static inline unsigned long virt_to_pfn(const void 
>> *kaddr)
>>   /* XXX Todo: implement assembly-optimized version of getorder. */
>>   #include <asm-generic/getorder.h>
>> -#endif /* ifdef __ASSEMBLY__ */
>> +#endif /* ifdef __ASSEMBLER__ */
>>   #endif /* ifdef __KERNEL__ */
>>   #endif
>> diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/ 
>> asm/processor.h
>> index 0cd39c2cdf8f7..b93c2cc4be22e 100644
>> --- a/arch/hexagon/include/asm/processor.h
>> +++ b/arch/hexagon/include/asm/processor.h
>> @@ -8,7 +8,7 @@
>>   #ifndef _ASM_PROCESSOR_H
>>   #define _ASM_PROCESSOR_H
>> -#ifndef __ASSEMBLY__
>> +#ifndef __ASSEMBLER__
>>   #include <asm/mem-layout.h>
>>   #include <asm/registers.h>
>> @@ -124,6 +124,6 @@ struct hexagon_switch_stack {
>>       unsigned long        lr;
>>   };
>> -#endif /* !__ASSEMBLY__ */
>> +#endif /* !__ASSEMBLER__ */
>>   #endif
>> diff --git a/arch/hexagon/include/asm/thread_info.h b/arch/hexagon/ 
>> include/asm/thread_info.h
>> index e90f280b9ce3e..a0da6c694c87b 100644
>> --- a/arch/hexagon/include/asm/thread_info.h
>> +++ b/arch/hexagon/include/asm/thread_info.h
>> @@ -10,7 +10,7 @@
>>   #ifdef __KERNEL__
>> -#ifndef __ASSEMBLY__
>> +#ifndef __ASSEMBLER__
>>   #include <asm/processor.h>
>>   #include <asm/registers.h>
>>   #include <asm/page.h>
>> @@ -20,7 +20,7 @@
>>   #define THREAD_SIZE        (1<<THREAD_SHIFT)
>>   #define THREAD_SIZE_ORDER    (THREAD_SHIFT - PAGE_SHIFT)
>> -#ifndef __ASSEMBLY__
>> +#ifndef __ASSEMBLER__
>>   /*
>>    * This is union'd with the "bottom" of the kernel stack.
>> @@ -47,13 +47,13 @@ struct thread_info {
>>       unsigned long        sp;
>>   };
>> -#else /* !__ASSEMBLY__ */
>> +#else /* !__ASSEMBLER__ */
>>   #include <asm/asm-offsets.h>
>> -#endif  /* __ASSEMBLY__  */
>> +#endif  /* __ASSEMBLER__  */
>> -#ifndef __ASSEMBLY__
>> +#ifndef __ASSEMBLER__
>>   #define INIT_THREAD_INFO(tsk)                   \
>>   {                                               \
>> @@ -73,7 +73,7 @@ struct thread_info {
>>   register struct thread_info *__current_thread_info 
>> asm(QUOTED_THREADINFO_REG);
>>   #define current_thread_info()  __current_thread_info
>> -#endif /* __ASSEMBLY__ */
>> +#endif /* __ASSEMBLER__ */
>>   /*
>>    * thread information flags
>