linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] LoongArch: Fix build warnings about export.h
@ 2025-06-08 14:15 Huacai Chen
  2025-06-09  0:39 ` Masahiro Yamada
  2025-06-16 18:57 ` Eric Biggers
  0 siblings, 2 replies; 4+ messages in thread
From: Huacai Chen @ 2025-06-08 14:15 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kbuild, Huacai Chen
  Cc: loongarch, Guo Ren, Xuerui Wang, Jiaxun Yang, linux-kernel,
	Huacai Chen

After commit a934a57a42f64a4 ("scripts/misc-check: check missing #include
<linux/export.h> when W=1") and 7d95680d64ac8e836c ("scripts/misc-check:
check unnecessary #include <linux/export.h> when W=1"), we get some build
warnings with W=1:

arch/loongarch/kernel/acpi.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
arch/loongarch/kernel/alternative.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
arch/loongarch/kernel/kfpu.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
arch/loongarch/kernel/traps.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
arch/loongarch/kernel/unwind_guess.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
arch/loongarch/kernel/unwind_orc.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
arch/loongarch/kernel/unwind_prologue.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
arch/loongarch/lib/crc32-loongarch.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
arch/loongarch/lib/csum.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
arch/loongarch/kernel/elf.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present
arch/loongarch/kernel/paravirt.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present
arch/loongarch/pci/pci.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present

So fix these build warnings for LoongArch.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 arch/loongarch/kernel/acpi.c            | 1 +
 arch/loongarch/kernel/alternative.c     | 1 +
 arch/loongarch/kernel/elf.c             | 1 -
 arch/loongarch/kernel/kfpu.c            | 1 +
 arch/loongarch/kernel/paravirt.c        | 1 -
 arch/loongarch/kernel/traps.c           | 1 +
 arch/loongarch/kernel/unwind_guess.c    | 1 +
 arch/loongarch/kernel/unwind_orc.c      | 3 ++-
 arch/loongarch/kernel/unwind_prologue.c | 1 +
 arch/loongarch/lib/crc32-loongarch.c    | 1 +
 arch/loongarch/lib/csum.c               | 1 +
 arch/loongarch/pci/pci.c                | 1 -
 12 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
index a54cd6fd3796..1367ca759468 100644
--- a/arch/loongarch/kernel/acpi.c
+++ b/arch/loongarch/kernel/acpi.c
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/acpi.h>
 #include <linux/efi-bgrt.h>
+#include <linux/export.h>
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/memblock.h>
diff --git a/arch/loongarch/kernel/alternative.c b/arch/loongarch/kernel/alternative.c
index 4ad13847e962..0e0c766df1e3 100644
--- a/arch/loongarch/kernel/alternative.c
+++ b/arch/loongarch/kernel/alternative.c
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
+#include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <asm/alternative.h>
diff --git a/arch/loongarch/kernel/elf.c b/arch/loongarch/kernel/elf.c
index 0fa81ced28dc..3d98c6aa00db 100644
--- a/arch/loongarch/kernel/elf.c
+++ b/arch/loongarch/kernel/elf.c
@@ -6,7 +6,6 @@
 
 #include <linux/binfmts.h>
 #include <linux/elf.h>
-#include <linux/export.h>
 #include <linux/sched.h>
 
 #include <asm/cpu-features.h>
diff --git a/arch/loongarch/kernel/kfpu.c b/arch/loongarch/kernel/kfpu.c
index 4c476904227f..141b49bd989c 100644
--- a/arch/loongarch/kernel/kfpu.c
+++ b/arch/loongarch/kernel/kfpu.c
@@ -4,6 +4,7 @@
  */
 
 #include <linux/cpu.h>
+#include <linux/export.h>
 #include <linux/init.h>
 #include <asm/fpu.h>
 #include <asm/smp.h>
diff --git a/arch/loongarch/kernel/paravirt.c b/arch/loongarch/kernel/paravirt.c
index e5a39bbad078..b1b51f920b23 100644
--- a/arch/loongarch/kernel/paravirt.c
+++ b/arch/loongarch/kernel/paravirt.c
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include <linux/export.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
 #include <linux/irq_work.h>
diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c
index 47fc2de6d150..3d9be6ca7ec5 100644
--- a/arch/loongarch/kernel/traps.c
+++ b/arch/loongarch/kernel/traps.c
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/kexec.h>
 #include <linux/module.h>
+#include <linux/export.h>
 #include <linux/extable.h>
 #include <linux/mm.h>
 #include <linux/sched/mm.h>
diff --git a/arch/loongarch/kernel/unwind_guess.c b/arch/loongarch/kernel/unwind_guess.c
index 98379b7d4147..33d5f33b374e 100644
--- a/arch/loongarch/kernel/unwind_guess.c
+++ b/arch/loongarch/kernel/unwind_guess.c
@@ -3,6 +3,7 @@
  * Copyright (C) 2022 Loongson Technology Corporation Limited
  */
 #include <asm/unwind.h>
+#include <linux/export.h>
 
 unsigned long unwind_get_return_address(struct unwind_state *state)
 {
diff --git a/arch/loongarch/kernel/unwind_orc.c b/arch/loongarch/kernel/unwind_orc.c
index d623935a7547..0005be49b056 100644
--- a/arch/loongarch/kernel/unwind_orc.c
+++ b/arch/loongarch/kernel/unwind_orc.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
-#include <linux/objtool.h>
+#include <linux/export.h>
 #include <linux/module.h>
+#include <linux/objtool.h>
 #include <linux/sort.h>
 #include <asm/exception.h>
 #include <asm/orc_header.h>
diff --git a/arch/loongarch/kernel/unwind_prologue.c b/arch/loongarch/kernel/unwind_prologue.c
index 929ae240280a..729e775bd40d 100644
--- a/arch/loongarch/kernel/unwind_prologue.c
+++ b/arch/loongarch/kernel/unwind_prologue.c
@@ -3,6 +3,7 @@
  * Copyright (C) 2022 Loongson Technology Corporation Limited
  */
 #include <linux/cpumask.h>
+#include <linux/export.h>
 #include <linux/ftrace.h>
 #include <linux/kallsyms.h>
 
diff --git a/arch/loongarch/lib/crc32-loongarch.c b/arch/loongarch/lib/crc32-loongarch.c
index b37cd8537b45..db22c2ec55e2 100644
--- a/arch/loongarch/lib/crc32-loongarch.c
+++ b/arch/loongarch/lib/crc32-loongarch.c
@@ -11,6 +11,7 @@
 
 #include <asm/cpu-features.h>
 #include <linux/crc32.h>
+#include <linux/export.h>
 #include <linux/module.h>
 #include <linux/unaligned.h>
 
diff --git a/arch/loongarch/lib/csum.c b/arch/loongarch/lib/csum.c
index df309ae4045d..bcc9d01d8c41 100644
--- a/arch/loongarch/lib/csum.c
+++ b/arch/loongarch/lib/csum.c
@@ -2,6 +2,7 @@
 // Copyright (C) 2019-2020 Arm Ltd.
 
 #include <linux/compiler.h>
+#include <linux/export.h>
 #include <linux/kasan-checks.h>
 #include <linux/kernel.h>
 
diff --git a/arch/loongarch/pci/pci.c b/arch/loongarch/pci/pci.c
index 2726639150bc..5bc9627a6cf9 100644
--- a/arch/loongarch/pci/pci.c
+++ b/arch/loongarch/pci/pci.c
@@ -3,7 +3,6 @@
  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
  */
 #include <linux/kernel.h>
-#include <linux/export.h>
 #include <linux/init.h>
 #include <linux/acpi.h>
 #include <linux/types.h>
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] LoongArch: Fix build warnings about export.h
  2025-06-08 14:15 [PATCH] LoongArch: Fix build warnings about export.h Huacai Chen
@ 2025-06-09  0:39 ` Masahiro Yamada
  2025-06-16 18:57 ` Eric Biggers
  1 sibling, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2025-06-09  0:39 UTC (permalink / raw)
  To: Huacai Chen
  Cc: linux-kbuild, Huacai Chen, loongarch, Guo Ren, Xuerui Wang,
	Jiaxun Yang, linux-kernel

On Sun, Jun 8, 2025 at 11:15 PM Huacai Chen <chenhuacai@loongson.cn> wrote:
>
> After commit a934a57a42f64a4 ("scripts/misc-check: check missing #include
> <linux/export.h> when W=1") and 7d95680d64ac8e836c ("scripts/misc-check:
> check unnecessary #include <linux/export.h> when W=1"), we get some build
> warnings with W=1:
>
> arch/loongarch/kernel/acpi.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/loongarch/kernel/alternative.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/loongarch/kernel/kfpu.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/loongarch/kernel/traps.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/loongarch/kernel/unwind_guess.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/loongarch/kernel/unwind_orc.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/loongarch/kernel/unwind_prologue.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/loongarch/lib/crc32-loongarch.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/loongarch/lib/csum.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/loongarch/kernel/elf.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present
> arch/loongarch/kernel/paravirt.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present
> arch/loongarch/pci/pci.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present
>
> So fix these build warnings for LoongArch.
>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
>  arch/loongarch/kernel/acpi.c            | 1 +
>  arch/loongarch/kernel/alternative.c     | 1 +
>  arch/loongarch/kernel/elf.c             | 1 -
>  arch/loongarch/kernel/kfpu.c            | 1 +
>  arch/loongarch/kernel/paravirt.c        | 1 -
>  arch/loongarch/kernel/traps.c           | 1 +
>  arch/loongarch/kernel/unwind_guess.c    | 1 +
>  arch/loongarch/kernel/unwind_orc.c      | 3 ++-
>  arch/loongarch/kernel/unwind_prologue.c | 1 +
>  arch/loongarch/lib/crc32-loongarch.c    | 1 +
>  arch/loongarch/lib/csum.c               | 1 +
>  arch/loongarch/pci/pci.c                | 1 -
>  12 files changed, 10 insertions(+), 4 deletions(-)

Thank you for your contribution.

Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] LoongArch: Fix build warnings about export.h
  2025-06-08 14:15 [PATCH] LoongArch: Fix build warnings about export.h Huacai Chen
  2025-06-09  0:39 ` Masahiro Yamada
@ 2025-06-16 18:57 ` Eric Biggers
  2025-06-19 12:28   ` Huacai Chen
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Biggers @ 2025-06-16 18:57 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Masahiro Yamada, linux-kbuild, Huacai Chen, loongarch, Guo Ren,
	Xuerui Wang, Jiaxun Yang, linux-kernel

On Sun, Jun 08, 2025 at 10:15:09PM +0800, Huacai Chen wrote:
> diff --git a/arch/loongarch/lib/crc32-loongarch.c b/arch/loongarch/lib/crc32-loongarch.c
> index b37cd8537b45..db22c2ec55e2 100644
> --- a/arch/loongarch/lib/crc32-loongarch.c
> +++ b/arch/loongarch/lib/crc32-loongarch.c
> @@ -11,6 +11,7 @@
>  
>  #include <asm/cpu-features.h>
>  #include <linux/crc32.h>
> +#include <linux/export.h>
>  #include <linux/module.h>
>  #include <linux/unaligned.h>

You can drop the change to crc32-loongarch.c, as it would conflict with
https://lore.kernel.org/r/20250601224441.778374-8-ebiggers@kernel.org/ and
https://lore.kernel.org/r/20250612183852.114878-1-ebiggers@kernel.org/ which are
in crc-next for 6.17 and already handle this issue.

- Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] LoongArch: Fix build warnings about export.h
  2025-06-16 18:57 ` Eric Biggers
@ 2025-06-19 12:28   ` Huacai Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Huacai Chen @ 2025-06-19 12:28 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Huacai Chen, Masahiro Yamada, linux-kbuild, loongarch, Guo Ren,
	Xuerui Wang, Jiaxun Yang, linux-kernel

Hi, Eric,

On Tue, Jun 17, 2025 at 2:57 AM Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Sun, Jun 08, 2025 at 10:15:09PM +0800, Huacai Chen wrote:
> > diff --git a/arch/loongarch/lib/crc32-loongarch.c b/arch/loongarch/lib/crc32-loongarch.c
> > index b37cd8537b45..db22c2ec55e2 100644
> > --- a/arch/loongarch/lib/crc32-loongarch.c
> > +++ b/arch/loongarch/lib/crc32-loongarch.c
> > @@ -11,6 +11,7 @@
> >
> >  #include <asm/cpu-features.h>
> >  #include <linux/crc32.h>
> > +#include <linux/export.h>
> >  #include <linux/module.h>
> >  #include <linux/unaligned.h>
>
> You can drop the change to crc32-loongarch.c, as it would conflict with
> https://lore.kernel.org/r/20250601224441.778374-8-ebiggers@kernel.org/ and
> https://lore.kernel.org/r/20250612183852.114878-1-ebiggers@kernel.org/ which are
> in crc-next for 6.17 and already handle this issue.
Thank you for your suggestion. But I plan to merge this patch for
6.16, while your commits are for 6.17, I can only keep it as is.

However, the conflicts can be easily solved when Linus merges your
code, or there is an alternative solution (if you want): update your
patches when this one gets upstream.

Huacai

>
> - Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-19 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-08 14:15 [PATCH] LoongArch: Fix build warnings about export.h Huacai Chen
2025-06-09  0:39 ` Masahiro Yamada
2025-06-16 18:57 ` Eric Biggers
2025-06-19 12:28   ` Huacai Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).