[PATCH v1 3/4] LoongArch: Remove some extern variables in source files

Tiezhu Yang posted 4 patches 2 weeks, 6 days ago
[PATCH v1 3/4] LoongArch: Remove some extern variables in source files
Posted by Tiezhu Yang 2 weeks, 6 days ago
There are declarations of the variable "eentry", "pcpu_handlers[]" and
"exception_handlers[]" in asm/setup.h, the source files already include
this header file directly or indirectly, so no need to declare them in
the source files, just remove the code.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/loongarch/kernel/unwind_orc.c      | 2 --
 arch/loongarch/kernel/unwind_prologue.c | 4 ----
 arch/loongarch/mm/tlb.c                 | 1 -
 3 files changed, 7 deletions(-)

diff --git a/arch/loongarch/kernel/unwind_orc.c b/arch/loongarch/kernel/unwind_orc.c
index 40f4d6c12cf6..d3bcbc82f101 100644
--- a/arch/loongarch/kernel/unwind_orc.c
+++ b/arch/loongarch/kernel/unwind_orc.c
@@ -350,8 +350,6 @@ EXPORT_SYMBOL_GPL(unwind_start);
 
 static inline unsigned long bt_address(unsigned long ra)
 {
-	extern unsigned long eentry;
-
 #if defined(CONFIG_NUMA) && !defined(CONFIG_PREEMPT_RT)
 	for (int cpu = 1; cpu < num_possible_cpus(); cpu++) {
 		int vec_sz = sizeof(exception_handlers);
diff --git a/arch/loongarch/kernel/unwind_prologue.c b/arch/loongarch/kernel/unwind_prologue.c
index 729e775bd40d..d04498d8090e 100644
--- a/arch/loongarch/kernel/unwind_prologue.c
+++ b/arch/loongarch/kernel/unwind_prologue.c
@@ -23,10 +23,6 @@ extern const int unwind_hint_lasx;
 extern const int unwind_hint_lbt;
 extern const int unwind_hint_ri;
 extern const int unwind_hint_watch;
-extern unsigned long eentry;
-#ifdef CONFIG_NUMA
-extern unsigned long pcpu_handlers[NR_CPUS];
-#endif
 
 static inline bool scan_handlers(unsigned long entry_offset)
 {
diff --git a/arch/loongarch/mm/tlb.c b/arch/loongarch/mm/tlb.c
index 6a3c91b9cacd..4014c4469587 100644
--- a/arch/loongarch/mm/tlb.c
+++ b/arch/loongarch/mm/tlb.c
@@ -262,7 +262,6 @@ static void output_pgtable_bits_defines(void)
 #ifdef CONFIG_NUMA
 unsigned long pcpu_handlers[NR_CPUS];
 #endif
-extern long exception_handlers[VECSIZE * 128 / sizeof(long)];
 
 static void setup_tlb_handler(int cpu)
 {
-- 
2.42.0
Re: [PATCH v1 3/4] LoongArch: Remove some extern variables in source files
Posted by Huacai Chen 2 weeks, 6 days ago
Hi, Tiezhu,

This patch can be the last one.


Huacai

On Tue, Jan 20, 2026 at 5:23 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>
> There are declarations of the variable "eentry", "pcpu_handlers[]" and
> "exception_handlers[]" in asm/setup.h, the source files already include
> this header file directly or indirectly, so no need to declare them in
> the source files, just remove the code.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/loongarch/kernel/unwind_orc.c      | 2 --
>  arch/loongarch/kernel/unwind_prologue.c | 4 ----
>  arch/loongarch/mm/tlb.c                 | 1 -
>  3 files changed, 7 deletions(-)
>
> diff --git a/arch/loongarch/kernel/unwind_orc.c b/arch/loongarch/kernel/unwind_orc.c
> index 40f4d6c12cf6..d3bcbc82f101 100644
> --- a/arch/loongarch/kernel/unwind_orc.c
> +++ b/arch/loongarch/kernel/unwind_orc.c
> @@ -350,8 +350,6 @@ EXPORT_SYMBOL_GPL(unwind_start);
>
>  static inline unsigned long bt_address(unsigned long ra)
>  {
> -       extern unsigned long eentry;
> -
>  #if defined(CONFIG_NUMA) && !defined(CONFIG_PREEMPT_RT)
>         for (int cpu = 1; cpu < num_possible_cpus(); cpu++) {
>                 int vec_sz = sizeof(exception_handlers);
> diff --git a/arch/loongarch/kernel/unwind_prologue.c b/arch/loongarch/kernel/unwind_prologue.c
> index 729e775bd40d..d04498d8090e 100644
> --- a/arch/loongarch/kernel/unwind_prologue.c
> +++ b/arch/loongarch/kernel/unwind_prologue.c
> @@ -23,10 +23,6 @@ extern const int unwind_hint_lasx;
>  extern const int unwind_hint_lbt;
>  extern const int unwind_hint_ri;
>  extern const int unwind_hint_watch;
> -extern unsigned long eentry;
> -#ifdef CONFIG_NUMA
> -extern unsigned long pcpu_handlers[NR_CPUS];
> -#endif
>
>  static inline bool scan_handlers(unsigned long entry_offset)
>  {
> diff --git a/arch/loongarch/mm/tlb.c b/arch/loongarch/mm/tlb.c
> index 6a3c91b9cacd..4014c4469587 100644
> --- a/arch/loongarch/mm/tlb.c
> +++ b/arch/loongarch/mm/tlb.c
> @@ -262,7 +262,6 @@ static void output_pgtable_bits_defines(void)
>  #ifdef CONFIG_NUMA
>  unsigned long pcpu_handlers[NR_CPUS];
>  #endif
> -extern long exception_handlers[VECSIZE * 128 / sizeof(long)];
>
>  static void setup_tlb_handler(int cpu)
>  {
> --
> 2.42.0
>