linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/16] ARM: address -Wmissing-prototype warnings
@ 2023-05-16 15:45 Arnd Bergmann
  2023-05-16 15:45 ` [PATCH 01/16] ARM: dma-mapping: hide unused dma_contiguous_early_fixup function Arnd Bergmann
                   ` (16 more replies)
  0 siblings, 17 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:45 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

This addresses all arm specific warnings outside of the mach-*/ code,
which I've submitted separately. The majority of the patches should be
straightforward, either adding an #include statement to get the right
header, or ensuring that an unused global function is left out of the
build when the prototype is hidden.

The ones that are a bit awkward are those that just add a prototype to
shut up the warning, but the prototypes are never used for calling the
function because the only caller is in assembler code. I tried to come
up with other ways to shut up the compiler, and ideally this would be
triggered by the 'asmlinkage' keyword as Ard suggested in the past, but
I could not come up with a way to do this.

All of the warnings have to be addressed in some form before the
warning can be enabled by default.

    Arnd

Link: https://people.kernel.org/arnd/missing-prototype-warnings-in-the-kernel

Arnd Bergmann (16):
  ARM: dma-mapping: hide unused dma_contiguous_early_fixup function
  ARM: traps: hide unused functions on NOMMU
  ARM: vfp: include asm/neon.h in vfpmodule.c
  ARM: vdso: add missing prototypes
  ARM: kprobes: avoid missing-declaration warnings
  ARM: tcm: move tcm_init() prototype to asm/tcm.h
  ARM: add prototype for function called only from asm
  ARM: add clear/copy_user_highpage declarations
  ARM: cacheflush: avoid __flush_anon_page() missing-prototype warning
  ARM: nommu: include asm/idmap.h
  ARM: move setup functions to header
  ARM: fiq: include asm/mach/irq.h for prototypes
  ARM: vfp: add vfp_entry prototype
  ARM: add missing syscall prototypes
  ARM: decompressor: move function prototypes to misc.h
  ARM: xip-kernel: add __inflate_kernel_data prototype

 arch/arm/boot/compressed/atags_to_fdt.c       |  1 +
 .../arm/boot/compressed/fdt_check_mem_start.c |  1 +
 arch/arm/boot/compressed/misc.c               |  6 ---
 arch/arm/boot/compressed/misc.h               | 11 ++++
 arch/arm/include/asm/ftrace.h                 |  4 ++
 arch/arm/include/asm/page.h                   | 22 ++++++++
 arch/arm/include/asm/ptrace.h                 |  3 ++
 arch/arm/include/asm/setup.h                  |  7 +++
 arch/arm/include/asm/signal.h                 |  5 ++
 arch/arm/include/asm/spectre.h                |  4 ++
 arch/arm/include/asm/suspend.h                |  1 +
 arch/arm/include/asm/syscalls.h               | 51 +++++++++++++++++++
 arch/arm/include/asm/tcm.h                    | 11 ++--
 arch/arm/include/asm/traps.h                  |  9 ++++
 arch/arm/include/asm/unwind.h                 |  4 ++
 arch/arm/include/asm/vdso.h                   |  5 ++
 arch/arm/include/asm/vfp.h                    |  1 +
 arch/arm/kernel/fiq.c                         |  1 +
 arch/arm/kernel/head-inflate-data.c           |  5 +-
 arch/arm/kernel/head.h                        |  8 +++
 arch/arm/kernel/setup.c                       |  7 ---
 arch/arm/kernel/signal.c                      |  1 +
 arch/arm/kernel/sys_arm.c                     |  1 +
 arch/arm/kernel/sys_oabi-compat.c             |  2 +
 arch/arm/kernel/traps.c                       |  2 +
 arch/arm/mm/dma-mapping.c                     |  2 +
 arch/arm/mm/fault.h                           |  4 ++
 arch/arm/mm/flush.c                           |  1 +
 arch/arm/mm/mmu.c                             |  2 +-
 arch/arm/mm/nommu.c                           |  1 +
 arch/arm/mm/tcm.h                             | 17 -------
 arch/arm/probes/kprobes/checkers-common.c     |  2 +-
 arch/arm/probes/kprobes/core.c                |  2 +-
 arch/arm/probes/kprobes/opt-arm.c             |  2 -
 arch/arm/probes/kprobes/test-core.c           |  2 +-
 arch/arm/probes/kprobes/test-core.h           |  4 ++
 arch/arm/vdso/vgettimeofday.c                 |  2 +
 arch/arm/vfp/vfp.h                            |  3 ++
 arch/arm/vfp/vfpmodule.c                      |  1 +
 39 files changed, 175 insertions(+), 43 deletions(-)
 create mode 100644 arch/arm/include/asm/syscalls.h
 create mode 100644 arch/arm/kernel/head.h
 delete mode 100644 arch/arm/mm/tcm.h

To: Russell King <linux@armlinux.org.uk>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-trace-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org


-- 
2.39.2


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

* [PATCH 01/16] ARM: dma-mapping: hide unused dma_contiguous_early_fixup function
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
@ 2023-05-16 15:45 ` Arnd Bergmann
  2023-05-16 15:45 ` [PATCH 02/16] ARM: traps: hide unused functions on NOMMU Arnd Bergmann
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:45 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

The dma_contiguous_early_fixup() function is a global __weak stub
with an arm specific override, but the declaration is in an #ifdef.

If CONFIG_DMA_CMA is disabled, there is no caller and no prototype,
which adds a warning for the definition:

arm/mm/dma-mapping.c:261:13: error: no previous prototype for 'dma_contiguous_early_fixup' [-Werror=missing-prototypes]

Enclose the definition in the same #ifdef as the prototype to avoid
that and save a few bytes of .init.text.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mm/dma-mapping.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index b4a33358d2e9..bc4ed5ce3e00 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -258,12 +258,14 @@ static struct dma_contig_early_reserve dma_mmu_remap[MAX_CMA_AREAS] __initdata;
 
 static int dma_mmu_remap_num __initdata;
 
+#ifdef CONFIG_DMA_CMA
 void __init dma_contiguous_early_fixup(phys_addr_t base, unsigned long size)
 {
 	dma_mmu_remap[dma_mmu_remap_num].base = base;
 	dma_mmu_remap[dma_mmu_remap_num].size = size;
 	dma_mmu_remap_num++;
 }
+#endif
 
 void __init dma_contiguous_remap(void)
 {
-- 
2.39.2


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

* [PATCH 02/16] ARM: traps: hide unused functions on NOMMU
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
  2023-05-16 15:45 ` [PATCH 01/16] ARM: dma-mapping: hide unused dma_contiguous_early_fixup function Arnd Bergmann
@ 2023-05-16 15:45 ` Arnd Bergmann
  2023-05-16 15:45 ` [PATCH 03/16] ARM: vfp: include asm/neon.h in vfpmodule.c Arnd Bergmann
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:45 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

A couple of functions in this file are only used on MMU-enabled
builds, and never even declared otherwise, causing these build
warnings:

arch/arm/kernel/traps.c:759:6: error: no previous prototype for '__pte_error' [-Werror=missing-prototypes]
arch/arm/kernel/traps.c:764:6: error: no previous prototype for '__pmd_error' [-Werror=missing-prototypes]
arch/arm/kernel/traps.c:769:6: error: no previous prototype for '__pgd_error' [-Werror=missing-prototypes]

Protect these in an #ifdef to avoid the warnings and save a little
bit of .text space.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/kernel/traps.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 40c7c807d67f..3bad79db5d6e 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -756,6 +756,7 @@ void __readwrite_bug(const char *fn)
 }
 EXPORT_SYMBOL(__readwrite_bug);
 
+#ifdef CONFIG_MMU
 void __pte_error(const char *file, int line, pte_t pte)
 {
 	pr_err("%s:%d: bad pte %08llx.\n", file, line, (long long)pte_val(pte));
@@ -770,6 +771,7 @@ void __pgd_error(const char *file, int line, pgd_t pgd)
 {
 	pr_err("%s:%d: bad pgd %08llx.\n", file, line, (long long)pgd_val(pgd));
 }
+#endif
 
 asmlinkage void __div0(void)
 {
-- 
2.39.2


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

* [PATCH 03/16] ARM: vfp: include asm/neon.h in vfpmodule.c
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
  2023-05-16 15:45 ` [PATCH 01/16] ARM: dma-mapping: hide unused dma_contiguous_early_fixup function Arnd Bergmann
  2023-05-16 15:45 ` [PATCH 02/16] ARM: traps: hide unused functions on NOMMU Arnd Bergmann
@ 2023-05-16 15:45 ` Arnd Bergmann
  2023-05-16 15:45 ` [PATCH 04/16] ARM: vdso: add missing prototypes Arnd Bergmann
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:45 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

Two functions defined here need the declaration in a header
to avoid W=1 warnings:

arch/arm/vfp/vfpmodule.c:735:6: error: no previous prototype for 'kernel_neon_begin' [-Werror=missing-prototypes]
arch/arm/vfp/vfpmodule.c:768:6: error: no previous prototype for 'kernel_neon_end' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/vfp/vfpmodule.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 349dcb944a93..1ba5078c1025 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -25,6 +25,7 @@
 #include <asm/thread_notify.h>
 #include <asm/traps.h>
 #include <asm/vfp.h>
+#include <asm/neon.h>
 
 #include "vfpinstr.h"
 #include "vfp.h"
-- 
2.39.2


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

* [PATCH 04/16] ARM: vdso: add missing prototypes
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (2 preceding siblings ...)
  2023-05-16 15:45 ` [PATCH 03/16] ARM: vfp: include asm/neon.h in vfpmodule.c Arnd Bergmann
@ 2023-05-16 15:45 ` Arnd Bergmann
  2023-05-16 15:45 ` [PATCH 05/16] ARM: kprobes: avoid missing-declaration warnings Arnd Bergmann
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:45 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

The __vdso_clock_* functions have no prototype, and the
__eabi_unwind_cpp_pr* functions have a prototype in a header that is
not included before the definition:

arch/arm/vdso/vgettimeofday.c:10:5: error: no previous prototype for '__vdso_clock_gettime' [-Werror=missing-prototypes]
arch/arm/vdso/vgettimeofday.c:16:5: error: no previous prototype for '__vdso_clock_gettime64' [-Werror=missing-prototypes]
arch/arm/vdso/vgettimeofday.c:22:5: error: no previous prototype for '__vdso_gettimeofday' [-Werror=missing-prototypes]
arch/arm/vdso/vgettimeofday.c:28:5: error: no previous prototype for '__vdso_clock_getres' [-Werror=missing-prototypes]
arch/arm/vdso/vgettimeofday.c:36:6: error: no previous prototype for '__aeabi_unwind_cpp_pr0' [-Werror=missing-prototypes]
arch/arm/vdso/vgettimeofday.c:40:6: error: no previous prototype for '__aeabi_unwind_cpp_pr1' [-Werror=missing-prototypes]
arch/arm/vdso/vgettimeofday.c:44:6: error: no previous prototype for '__aeabi_unwind_cpp_pr2' [-Werror=missing-prototypes]

Add the prototypes in an appropriate header and ensure that
both are included here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/include/asm/vdso.h   | 5 +++++
 arch/arm/vdso/vgettimeofday.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/arch/arm/include/asm/vdso.h b/arch/arm/include/asm/vdso.h
index 5b85889f82ee..422c3afa806a 100644
--- a/arch/arm/include/asm/vdso.h
+++ b/arch/arm/include/asm/vdso.h
@@ -24,6 +24,11 @@ static inline void arm_install_vdso(struct mm_struct *mm, unsigned long addr)
 
 #endif /* CONFIG_VDSO */
 
+int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts);
+int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts);
+int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
+int __vdso_clock_getres(clockid_t clock_id, struct old_timespec32 *res);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff --git a/arch/arm/vdso/vgettimeofday.c b/arch/arm/vdso/vgettimeofday.c
index 1976c6f325a4..a003beacac76 100644
--- a/arch/arm/vdso/vgettimeofday.c
+++ b/arch/arm/vdso/vgettimeofday.c
@@ -6,6 +6,8 @@
  */
 #include <linux/time.h>
 #include <linux/types.h>
+#include <asm/vdso.h>
+#include <asm/unwind.h>
 
 int __vdso_clock_gettime(clockid_t clock,
 			 struct old_timespec32 *ts)
-- 
2.39.2


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

* [PATCH 05/16] ARM: kprobes: avoid missing-declaration warnings
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (3 preceding siblings ...)
  2023-05-16 15:45 ` [PATCH 04/16] ARM: vdso: add missing prototypes Arnd Bergmann
@ 2023-05-16 15:45 ` Arnd Bergmann
  2023-05-17  1:29   ` Masami Hiramatsu
  2023-05-16 15:45 ` [PATCH 06/16] ARM: tcm: move tcm_init() prototype to asm/tcm.h Arnd Bergmann
                   ` (11 subsequent siblings)
  16 siblings, 1 reply; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:45 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

checker_stack_use_t32strd() and kprobe_handler() can be made static since
they are not used from other files, while coverage_start_registers()
and __kprobes_test_case() are used from assembler code, and just need
a declaration to avoid a warning with the global definition.

arch/arm/probes/kprobes/checkers-common.c:43:18: error: no previous prototype for 'checker_stack_use_t32strd'
arch/arm/probes/kprobes/core.c:236:16: error: no previous prototype for 'kprobe_handler'
arch/arm/probes/kprobes/test-core.c:723:10: error: no previous prototype for 'coverage_start_registers'
arch/arm/probes/kprobes/test-core.c:918:14: error: no previous prototype for '__kprobes_test_case_start'
arch/arm/probes/kprobes/test-core.c:952:14: error: no previous prototype for '__kprobes_test_case_end_16'
arch/arm/probes/kprobes/test-core.c:967:14: error: no previous prototype for '__kprobes_test_case_end_32'

Fixes: 6624cf651f1a ("ARM: kprobes: collects stack consumption for store instructions")
Fixes: 454f3e132d05 ("ARM/kprobes: Remove jprobe arm implementation")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/probes/kprobes/checkers-common.c | 2 +-
 arch/arm/probes/kprobes/core.c            | 2 +-
 arch/arm/probes/kprobes/opt-arm.c         | 2 --
 arch/arm/probes/kprobes/test-core.c       | 2 +-
 arch/arm/probes/kprobes/test-core.h       | 4 ++++
 5 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/probes/kprobes/checkers-common.c b/arch/arm/probes/kprobes/checkers-common.c
index 4d720990cf2a..eba7ac4725c0 100644
--- a/arch/arm/probes/kprobes/checkers-common.c
+++ b/arch/arm/probes/kprobes/checkers-common.c
@@ -40,7 +40,7 @@ enum probes_insn checker_stack_use_imm_0xx(probes_opcode_t insn,
  * Different from other insn uses imm8, the real addressing offset of
  * STRD in T32 encoding should be imm8 * 4. See ARMARM description.
  */
-enum probes_insn checker_stack_use_t32strd(probes_opcode_t insn,
+static enum probes_insn checker_stack_use_t32strd(probes_opcode_t insn,
 		struct arch_probes_insn *asi,
 		const struct decode_header *h)
 {
diff --git a/arch/arm/probes/kprobes/core.c b/arch/arm/probes/kprobes/core.c
index 88999ed2cfc4..3ee0e3024ff0 100644
--- a/arch/arm/probes/kprobes/core.c
+++ b/arch/arm/probes/kprobes/core.c
@@ -233,7 +233,7 @@ singlestep(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb)
  * kprobe, and that level is reserved for user kprobe handlers, so we can't
  * risk encountering a new kprobe in an interrupt handler.
  */
-void __kprobes kprobe_handler(struct pt_regs *regs)
+static void __kprobes kprobe_handler(struct pt_regs *regs)
 {
 	struct kprobe *p, *cur;
 	struct kprobe_ctlblk *kcb;
diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c
index dbef34ed933f..7f65048380ca 100644
--- a/arch/arm/probes/kprobes/opt-arm.c
+++ b/arch/arm/probes/kprobes/opt-arm.c
@@ -145,8 +145,6 @@ __arch_remove_optimized_kprobe(struct optimized_kprobe *op, int dirty)
 	}
 }
 
-extern void kprobe_handler(struct pt_regs *regs);
-
 static void
 optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
 {
diff --git a/arch/arm/probes/kprobes/test-core.c b/arch/arm/probes/kprobes/test-core.c
index c562832b8627..171c7076b89f 100644
--- a/arch/arm/probes/kprobes/test-core.c
+++ b/arch/arm/probes/kprobes/test-core.c
@@ -720,7 +720,7 @@ static const char coverage_register_lookup[16] = {
 	[REG_TYPE_NOSPPCX]	= COVERAGE_ANY_REG | COVERAGE_SP,
 };
 
-unsigned coverage_start_registers(const struct decode_header *h)
+static unsigned coverage_start_registers(const struct decode_header *h)
 {
 	unsigned regs = 0;
 	int i;
diff --git a/arch/arm/probes/kprobes/test-core.h b/arch/arm/probes/kprobes/test-core.h
index 56ad3c0aaeea..c7297037c162 100644
--- a/arch/arm/probes/kprobes/test-core.h
+++ b/arch/arm/probes/kprobes/test-core.h
@@ -454,3 +454,7 @@ void kprobe_thumb32_test_cases(void);
 #else
 void kprobe_arm_test_cases(void);
 #endif
+
+void __kprobes_test_case_start(void);
+void __kprobes_test_case_end_16(void);
+void __kprobes_test_case_end_32(void);
-- 
2.39.2


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

* [PATCH 06/16] ARM: tcm: move tcm_init() prototype to asm/tcm.h
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (4 preceding siblings ...)
  2023-05-16 15:45 ` [PATCH 05/16] ARM: kprobes: avoid missing-declaration warnings Arnd Bergmann
@ 2023-05-16 15:45 ` Arnd Bergmann
  2023-05-22  7:34   ` Linus Walleij
  2023-05-16 15:45 ` [PATCH 07/16] ARM: add prototype for function called only from asm Arnd Bergmann
                   ` (10 subsequent siblings)
  16 siblings, 1 reply; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:45 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

The function definition is in a file that does not include the
header with the declaration:

arch/arm/kernel/tcm.c:256:13: error: no previous prototype for 'tcm_init'

Move the declaration to a global header where it can actually be
included.

Fixes: de40614e92bf ("ARM: 7694/1: ARM, TCM: initialize TCM in paging_init(), instead of setup_arch()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/include/asm/tcm.h | 11 ++++++++---
 arch/arm/mm/mmu.c          |  2 +-
 arch/arm/mm/tcm.h          | 17 -----------------
 3 files changed, 9 insertions(+), 21 deletions(-)
 delete mode 100644 arch/arm/mm/tcm.h

diff --git a/arch/arm/include/asm/tcm.h b/arch/arm/include/asm/tcm.h
index d8bd8a4b0ede..e1f7dca86a22 100644
--- a/arch/arm/include/asm/tcm.h
+++ b/arch/arm/include/asm/tcm.h
@@ -9,9 +9,7 @@
 #ifndef __ASMARM_TCM_H
 #define __ASMARM_TCM_H
 
-#ifndef CONFIG_HAVE_TCM
-#error "You should not be including tcm.h unless you have a TCM!"
-#endif
+#ifdef CONFIG_HAVE_TCM
 
 #include <linux/compiler.h>
 
@@ -29,4 +27,11 @@ void tcm_free(void *addr, size_t len);
 bool tcm_dtcm_present(void);
 bool tcm_itcm_present(void);
 
+void __init tcm_init(void);
+#else
+/* No TCM support, just blank inlines to be optimized out */
+static inline void tcm_init(void)
+{
+}
+#endif
 #endif
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 463fc2a8448f..f3a52c08a200 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -21,6 +21,7 @@
 #include <asm/sections.h>
 #include <asm/setup.h>
 #include <asm/smp_plat.h>
+#include <asm/tcm.h>
 #include <asm/tlb.h>
 #include <asm/highmem.h>
 #include <asm/system_info.h>
@@ -37,7 +38,6 @@
 
 #include "fault.h"
 #include "mm.h"
-#include "tcm.h"
 
 extern unsigned long __atags_pointer;
 
diff --git a/arch/arm/mm/tcm.h b/arch/arm/mm/tcm.h
deleted file mode 100644
index 6b80a760d875..000000000000
--- a/arch/arm/mm/tcm.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (C) 2008-2009 ST-Ericsson AB
- * TCM memory handling for ARM systems
- *
- * Author: Linus Walleij <linus.walleij@stericsson.com>
- * Author: Rickard Andersson <rickard.andersson@stericsson.com>
- */
-
-#ifdef CONFIG_HAVE_TCM
-void __init tcm_init(void);
-#else
-/* No TCM support, just blank inlines to be optimized out */
-static inline void tcm_init(void)
-{
-}
-#endif
-- 
2.39.2


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

* [PATCH 07/16] ARM: add prototype for function called only from asm
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (5 preceding siblings ...)
  2023-05-16 15:45 ` [PATCH 06/16] ARM: tcm: move tcm_init() prototype to asm/tcm.h Arnd Bergmann
@ 2023-05-16 15:45 ` Arnd Bergmann
  2023-05-16 15:45 ` [PATCH 08/16] ARM: add clear/copy_user_highpage declarations Arnd Bergmann
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:45 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

When building with 'make W=1', the compiler warns about any function
definition that does not come with a prototype in a header, to ensure
it matches what the caller expects.

This includes functions that are only ever caller from assembly
code and don't technically need a declaration:

arch/arm/kernel/ftrace.c:227:6: error: no previous prototype for 'prepare_ftrace_return'
arch/arm/kernel/ptrace.c:850:16: error: no previous prototype for 'syscall_trace_enter'
arch/arm/kernel/ptrace.c:878:17: error: no previous prototype for 'syscall_trace_exit'
arch/arm/kernel/signal.c:601:1: error: no previous prototype for 'do_work_pending'
arch/arm/kernel/signal.c:672:17: error: no previous prototype for 'do_rseq_syscall'
arch/arm/kernel/suspend.c:75:6: error: no previous prototype for '__cpu_suspend_save'
arch/arm/kernel/traps.c:451:17: error: no previous prototype for 'do_undefinstr'
arch/arm/kernel/traps.c:516:39: error: no previous prototype for 'handle_fiq_as_nmi'
arch/arm/kernel/traps.c:535:17: error: no previous prototype for 'bad_mode'
arch/arm/kernel/traps.c:608:16: error: no previous prototype for 'arm_syscall'
arch/arm/kernel/traps.c:734:1: error: no previous prototype for 'baddataabort'
arch/arm/kernel/traps.c:774:17: error: no previous prototype for '__div0'
arch/arm/kernel/traps.c:97:6: error: no previous prototype for 'dump_backtrace_stm'
arch/arm/kernel/unwind.c:40:6: error: no previous prototype for '__aeabi_unwind_cpp_pr0'
arch/arm/kernel/unwind.c:45:6: error: no previous prototype for '__aeabi_unwind_cpp_pr1'
arch/arm/kernel/unwind.c:50:6: error: no previous prototype for '__aeabi_unwind_cpp_pr2'
arch/arm/mm/fault.c:554:1: error: no previous prototype for 'do_DataAbort'
arch/arm/mm/fault.c:584:1: error: no previous prototype for 'do_PrefetchAbort'
arch/arm/mm/proc-v7-bugs.c:280:6: error: no previous prototype for 'cpu_v7_ca8_ibe'
arch/arm/mm/proc-v7-bugs.c:293:6: error: no previous prototype for 'cpu_v7_bugs_init'
arch/arm/vdso/vgettimeofday.c:36:6: error: no previous prototype for '__aeabi_unwind_cpp_pr0'
arch/arm/vdso/vgettimeofday.c:40:6: error: no previous prototype for '__aeabi_unwind_cpp_pr1'
arch/arm/vdso/vgettimeofday.c:44:6: error: no previous prototype for '__aeabi_unwind_cpp_pr2'
arch/arm/vfp/vfpmodule.c:323:6: error: no previous prototype for 'VFP_bounce'

Add the prototypes anyway, to allow enabling this warning by default in
the future.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/include/asm/ftrace.h  | 4 ++++
 arch/arm/include/asm/ptrace.h  | 3 +++
 arch/arm/include/asm/signal.h  | 5 +++++
 arch/arm/include/asm/spectre.h | 4 ++++
 arch/arm/include/asm/suspend.h | 1 +
 arch/arm/include/asm/traps.h   | 9 +++++++++
 arch/arm/include/asm/unwind.h  | 4 ++++
 arch/arm/include/asm/vfp.h     | 1 +
 arch/arm/mm/fault.h            | 4 ++++
 9 files changed, 35 insertions(+)

diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index 4e29bff7556d..3b2d84ec11f3 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -73,6 +73,10 @@ static inline bool arch_syscall_match_sym_name(const char *sym,
 	return !strcasecmp(sym, name);
 }
 
+void prepare_ftrace_return(unsigned long *parent, unsigned long self,
+			   unsigned long frame_pointer,
+			   unsigned long stack_pointer);
+
 #endif /* ifndef __ASSEMBLY__ */
 
 #endif /* _ASM_ARM_FTRACE */
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 483b8ddfcb82..7f44e88d1f25 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -193,5 +193,8 @@ static inline unsigned long it_advance(unsigned long cpsr)
 	return cpsr;
 }
 
+int syscall_trace_enter(struct pt_regs *regs);
+void syscall_trace_exit(struct pt_regs *regs);
+
 #endif /* __ASSEMBLY__ */
 #endif
diff --git a/arch/arm/include/asm/signal.h b/arch/arm/include/asm/signal.h
index 430be7774402..8b84092d1518 100644
--- a/arch/arm/include/asm/signal.h
+++ b/arch/arm/include/asm/signal.h
@@ -22,4 +22,9 @@ typedef struct {
 #define __ARCH_HAS_SA_RESTORER
 
 #include <asm/sigcontext.h>
+
+void do_rseq_syscall(struct pt_regs *regs);
+int do_work_pending(struct pt_regs *regs, unsigned int thread_flags,
+		    int syscall);
+
 #endif
diff --git a/arch/arm/include/asm/spectre.h b/arch/arm/include/asm/spectre.h
index 85f9e538fb32..d9c28b3b6b62 100644
--- a/arch/arm/include/asm/spectre.h
+++ b/arch/arm/include/asm/spectre.h
@@ -35,4 +35,8 @@ static inline void spectre_v2_update_state(unsigned int state,
 
 int spectre_bhb_update_vectors(unsigned int method);
 
+void cpu_v7_ca8_ibe(void);
+void cpu_v7_ca15_ibe(void);
+void cpu_v7_bugs_init(void);
+
 #endif
diff --git a/arch/arm/include/asm/suspend.h b/arch/arm/include/asm/suspend.h
index 506314265c6f..be81b9ca2ea1 100644
--- a/arch/arm/include/asm/suspend.h
+++ b/arch/arm/include/asm/suspend.h
@@ -13,5 +13,6 @@ extern void cpu_resume(void);
 extern void cpu_resume_no_hyp(void);
 extern void cpu_resume_arm(void);
 extern int cpu_suspend(unsigned long, int (*)(unsigned long));
+extern void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr);
 
 #endif
diff --git a/arch/arm/include/asm/traps.h b/arch/arm/include/asm/traps.h
index 987fefb0a4db..0aaefe3e1700 100644
--- a/arch/arm/include/asm/traps.h
+++ b/arch/arm/include/asm/traps.h
@@ -35,4 +35,13 @@ extern void ptrace_break(struct pt_regs *regs);
 
 extern void *vectors_page;
 
+asmlinkage void dump_backtrace_stm(u32 *stack, u32 instruction, const char *loglvl);
+asmlinkage void do_undefinstr(struct pt_regs *regs);
+asmlinkage void handle_fiq_as_nmi(struct pt_regs *regs);
+asmlinkage void bad_mode(struct pt_regs *regs, int reason);
+asmlinkage int arm_syscall(int no, struct pt_regs *regs);
+asmlinkage void baddataabort(int code, unsigned long instr, struct pt_regs *regs);
+asmlinkage void __div0(void);
+asmlinkage void handle_bad_stack(struct pt_regs *regs);
+
 #endif
diff --git a/arch/arm/include/asm/unwind.h b/arch/arm/include/asm/unwind.h
index b51f85417f58..d60b09a5acfc 100644
--- a/arch/arm/include/asm/unwind.h
+++ b/arch/arm/include/asm/unwind.h
@@ -40,6 +40,10 @@ extern void unwind_table_del(struct unwind_table *tab);
 extern void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk,
 			     const char *loglvl);
 
+void __aeabi_unwind_cpp_pr0(void);
+void __aeabi_unwind_cpp_pr1(void);
+void __aeabi_unwind_cpp_pr2(void);
+
 #endif	/* !__ASSEMBLY__ */
 
 #ifdef CONFIG_ARM_UNWIND
diff --git a/arch/arm/include/asm/vfp.h b/arch/arm/include/asm/vfp.h
index 157ea3426158..5b57b8768bac 100644
--- a/arch/arm/include/asm/vfp.h
+++ b/arch/arm/include/asm/vfp.h
@@ -102,6 +102,7 @@
 
 #ifndef __ASSEMBLY__
 void vfp_disable(void);
+void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs);
 #endif
 
 #endif /* __ASM_VFP_H */
diff --git a/arch/arm/mm/fault.h b/arch/arm/mm/fault.h
index 54927ba1fa6e..e8f8c1902544 100644
--- a/arch/arm/mm/fault.h
+++ b/arch/arm/mm/fault.h
@@ -37,5 +37,9 @@ static inline int fsr_fs(unsigned int fsr)
 
 void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs);
 void early_abt_enable(void);
+asmlinkage void do_DataAbort(unsigned long addr, unsigned int fsr,
+			     struct pt_regs *regs);
+asmlinkage void do_PrefetchAbort(unsigned long addr, unsigned int ifsr,
+				 struct pt_regs *regs);
 
 #endif	/* __ARCH_ARM_FAULT_H */
-- 
2.39.2


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

* [PATCH 08/16] ARM: add clear/copy_user_highpage declarations
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (6 preceding siblings ...)
  2023-05-16 15:45 ` [PATCH 07/16] ARM: add prototype for function called only from asm Arnd Bergmann
@ 2023-05-16 15:45 ` Arnd Bergmann
  2023-05-16 15:45 ` [PATCH 09/16] ARM: cacheflush: avoid __flush_anon_page() missing-prototype warning Arnd Bergmann
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:45 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

The CPU specific helpers have to be global functions when building
a kernel for just one CPU, but are called through indirect function
pointers in a multi-CPU kernel. This config currently lacks the
declarations for the individual helpers, e.g.:

arch/arm/mm/copypage-v4wb.c:47:6: error: no previous prototype for 'v4wb_copy_user_highpage' [-Werror=missing-prototypes]
arch/arm/mm/copypage-v4wb.c:65:6: error: no previous prototype for 'v4wb_clear_user_highpage' [-Werror=missing-prototypes]

Add the complete set of prototypes in asm/page.h to allow
building iwth -Wmissing-prototypes.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/include/asm/page.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index 74bb5947b387..28c63d172a96 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -113,6 +113,28 @@ struct cpu_user_fns {
 			unsigned long vaddr, struct vm_area_struct *vma);
 };
 
+void fa_copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma);
+void fa_clear_user_highpage(struct page *page, unsigned long vaddr);
+void feroceon_copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma);
+void feroceon_clear_user_highpage(struct page *page, unsigned long vaddr);
+void v4_mc_copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma);
+void v4_mc_clear_user_highpage(struct page *page, unsigned long vaddr);
+void v4wb_copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma);
+void v4wb_clear_user_highpage(struct page *page, unsigned long vaddr);
+void v4wt_copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma);
+void v4wt_clear_user_highpage(struct page *page, unsigned long vaddr);
+void xsc3_mc_copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma);
+void xsc3_mc_clear_user_highpage(struct page *page, unsigned long vaddr);
+void xscale_mc_copy_user_highpage(struct page *to, struct page *from,
+	unsigned long vaddr, struct vm_area_struct *vma);
+void xscale_mc_clear_user_highpage(struct page *page, unsigned long vaddr);
+
 #ifdef MULTI_USER
 extern struct cpu_user_fns cpu_user;
 
-- 
2.39.2


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

* [PATCH 09/16] ARM: cacheflush: avoid __flush_anon_page() missing-prototype warning
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (7 preceding siblings ...)
  2023-05-16 15:45 ` [PATCH 08/16] ARM: add clear/copy_user_highpage declarations Arnd Bergmann
@ 2023-05-16 15:45 ` Arnd Bergmann
  2023-05-16 15:45 ` [PATCH 10/16] ARM: nommu: include asm/idmap.h Arnd Bergmann
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:45 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

The prototype for __flush_anon_page() is intentionally hidden
inside the flush_anon_page() inline function to prevent it from
being called from drivers.

When building with 'W=1', this causes a warning:

arch/arm/mm/flush.c:358:6: error: no previous prototype for '__flush_anon_page' [-Werror=missing-prototypes]

Work around this by adding a prototype directly next to the function
definition.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mm/flush.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 9b112009c708..43678137a9b2 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -355,6 +355,7 @@ EXPORT_SYMBOL(flush_dcache_page);
  *  memcpy() to/from page
  *  if written to page, flush_dcache_page()
  */
+void __flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr);
 void __flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr)
 {
 	unsigned long pfn;
-- 
2.39.2


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

* [PATCH 10/16] ARM: nommu: include asm/idmap.h
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (8 preceding siblings ...)
  2023-05-16 15:45 ` [PATCH 09/16] ARM: cacheflush: avoid __flush_anon_page() missing-prototype warning Arnd Bergmann
@ 2023-05-16 15:45 ` Arnd Bergmann
  2023-05-16 15:46 ` [PATCH 11/16] ARM: move setup functions to header Arnd Bergmann
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:45 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

setup_mm_for_reboot() is declared in asm/idmap.h but that is not included
for the definition, causing a W=1 warning:

arch/arm/mm/nommu.c:178:6: error: no previous prototype for 'setup_mm_for_reboot' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mm/nommu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 53f2d8774fdb..43cfd06bbeba 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -21,6 +21,7 @@
 #include <asm/cputype.h>
 #include <asm/mpu.h>
 #include <asm/procinfo.h>
+#include <asm/idmap.h>
 
 #include "mm.h"
 
-- 
2.39.2


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

* [PATCH 11/16] ARM: move setup functions to header
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (9 preceding siblings ...)
  2023-05-16 15:45 ` [PATCH 10/16] ARM: nommu: include asm/idmap.h Arnd Bergmann
@ 2023-05-16 15:46 ` Arnd Bergmann
  2023-05-22  7:35   ` Linus Walleij
  2023-05-16 15:46 ` [PATCH 12/16] ARM: fiq: include asm/mach/irq.h for prototypes Arnd Bergmann
                   ` (5 subsequent siblings)
  16 siblings, 1 reply; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:46 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

A couple of functions are declared in arch/arm/mm/mmu.c rather than in a header,
which causes W=1 build warnings:

arch/arm/mm/init.c:97:13: error: no previous prototype for 'setup_dma_zone' [-Werror=missing-prototypes]
arch/arm/mm/mmu.c:118:13: error: no previous prototype for 'init_default_cache_policy' [-Werror=missing-prototypes]
arch/arm/mm/mmu.c:1195:13: error: no previous prototype for 'adjust_lowmem_bounds' [-Werror=missing-prototypes]
arch/arm/mm/mmu.c:1761:13: error: no previous prototype for 'paging_init' [-Werror=missing-prototypes]
arch/arm/mm/mmu.c:1794:13: error: no previous prototype for 'early_mm_init' [-Werror=missing-prototypes]

Move the declaratsion to asm/setup.h so they can be seen by the compiler
while building the definition.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/include/asm/setup.h | 7 +++++++
 arch/arm/kernel/setup.c      | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index ba0872a8dcda..28ca2a17394a 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -28,4 +28,11 @@ extern void save_atags(const struct tag *tags);
 static inline void save_atags(const struct tag *tags) { }
 #endif
 
+struct machine_desc;
+void init_default_cache_policy(unsigned long);
+void paging_init(const struct machine_desc *desc);
+void early_mm_init(const struct machine_desc *);
+void adjust_lowmem_bounds(void);
+void setup_dma_zone(const struct machine_desc *desc);
+
 #endif
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 75cd4699e7b3..703233a7bfe3 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -76,13 +76,6 @@ static int __init fpe_setup(char *line)
 __setup("fpe=", fpe_setup);
 #endif
 
-extern void init_default_cache_policy(unsigned long);
-extern void paging_init(const struct machine_desc *desc);
-extern void early_mm_init(const struct machine_desc *);
-extern void adjust_lowmem_bounds(void);
-extern enum reboot_mode reboot_mode;
-extern void setup_dma_zone(const struct machine_desc *desc);
-
 unsigned int processor_id;
 EXPORT_SYMBOL(processor_id);
 unsigned int __machine_arch_type __read_mostly;
-- 
2.39.2


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

* [PATCH 12/16] ARM: fiq: include asm/mach/irq.h for prototypes
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (10 preceding siblings ...)
  2023-05-16 15:46 ` [PATCH 11/16] ARM: move setup functions to header Arnd Bergmann
@ 2023-05-16 15:46 ` Arnd Bergmann
  2023-05-16 15:46 ` [PATCH 13/16] ARM: vfp: add vfp_entry prototype Arnd Bergmann
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:46 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

There are two global functions in fiq.c that get called from
other files through an extern declaration, but a W=1 build
warns about the header not being included before the definition:

arch/arm/kernel/fiq.c:85:5: error: no previous prototype for 'show_fiq_list' [-Werror=missing-prototypes]
arch/arm/kernel/fiq.c:159:13: error: no previous prototype for 'init_FIQ' [-Werror=missing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/kernel/fiq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c
index 98ca3e3fa847..d2c8e5313539 100644
--- a/arch/arm/kernel/fiq.c
+++ b/arch/arm/kernel/fiq.c
@@ -45,6 +45,7 @@
 #include <asm/cacheflush.h>
 #include <asm/cp15.h>
 #include <asm/fiq.h>
+#include <asm/mach/irq.h>
 #include <asm/irq.h>
 #include <asm/traps.h>
 
-- 
2.39.2


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

* [PATCH 13/16] ARM: vfp: add vfp_entry prototype
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (11 preceding siblings ...)
  2023-05-16 15:46 ` [PATCH 12/16] ARM: fiq: include asm/mach/irq.h for prototypes Arnd Bergmann
@ 2023-05-16 15:46 ` Arnd Bergmann
  2023-05-17 11:13   ` Ard Biesheuvel
  2023-05-16 15:46 ` [PATCH 14/16] ARM: add missing syscall prototypes Arnd Bergmann
                   ` (3 subsequent siblings)
  16 siblings, 1 reply; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:46 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

vfp_entry is only called from assembler code, so it does not
need a declaration. Since gcc complains when extra warnings
are enabled, add one anyway to avoid:

arch/arm/vfp/vfpmodule.c:657:17: warning: no previous prototype for function 'vfp_entry' [-Wmissing-prototypes]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/vfp/vfp.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h
index 5cd6d5053271..10d9c0da0fd4 100644
--- a/arch/arm/vfp/vfp.h
+++ b/arch/arm/vfp/vfp.h
@@ -375,3 +375,6 @@ struct op {
 };
 
 asmlinkage void vfp_save_state(void *location, u32 fpexc);
+struct thread_info;
+asmlinkage void vfp_entry(u32 trigger, struct thread_info *ti, u32 resume_pc,
+			  u32 resume_return_address);
-- 
2.39.2


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

* [PATCH 14/16] ARM: add missing syscall prototypes
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (12 preceding siblings ...)
  2023-05-16 15:46 ` [PATCH 13/16] ARM: vfp: add vfp_entry prototype Arnd Bergmann
@ 2023-05-16 15:46 ` Arnd Bergmann
  2023-05-16 15:46 ` [PATCH 15/16] ARM: decompressor: move function prototypes to misc.h Arnd Bergmann
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:46 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

All architecture-independent system calls have prototypes in
include/linux/syscalls.h, but there are a few that only exist
on arm or that take the pt_regs directly. These cause a W=1
warning such as:

arch/arm/kernel/signal.c:186:16: error: no previous prototype for 'sys_sigreturn' [-Werror=missing-prototypes]
arch/arm/kernel/signal.c:216:16: error: no previous prototype for 'sys_rt_sigreturn' [-Werror=missing-prototypes]
arch/arm/kernel/sys_arm.c:32:17: error: no previous prototype for 'sys_arm_fadvise64_64' [-Werror=missing-prototypes]

Add prototypes for all custom syscalls on arm and add them
to asm/syscalls.h.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/include/asm/syscalls.h   | 51 +++++++++++++++++++++++++++++++
 arch/arm/kernel/signal.c          |  1 +
 arch/arm/kernel/sys_arm.c         |  1 +
 arch/arm/kernel/sys_oabi-compat.c |  2 ++
 4 files changed, 55 insertions(+)
 create mode 100644 arch/arm/include/asm/syscalls.h

diff --git a/arch/arm/include/asm/syscalls.h b/arch/arm/include/asm/syscalls.h
new file mode 100644
index 000000000000..5912e7cffa6a
--- /dev/null
+++ b/arch/arm/include/asm/syscalls.h
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __ASM_SYSCALLS_H
+#define __ASM_SYSCALLS_H
+
+#include <linux/linkage.h>
+#include <linux/types.h>
+
+struct pt_regs;
+asmlinkage int sys_sigreturn(struct pt_regs *regs);
+asmlinkage int sys_rt_sigreturn(struct pt_regs *regs);
+asmlinkage long sys_arm_fadvise64_64(int fd, int advice,
+				     loff_t offset, loff_t len);
+
+struct oldabi_stat64;
+asmlinkage long sys_oabi_stat64(const char __user * filename,
+				struct oldabi_stat64 __user * statbuf);
+asmlinkage long sys_oabi_lstat64(const char __user * filename,
+				 struct oldabi_stat64 __user * statbuf);
+asmlinkage long sys_oabi_fstat64(unsigned long fd,
+				 struct oldabi_stat64 __user * statbuf);
+asmlinkage long sys_oabi_fstatat64(int dfd,
+				   const char __user *filename,
+				   struct oldabi_stat64  __user *statbuf,
+				   int flag);
+asmlinkage long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd,
+				 unsigned long arg);
+struct oabi_epoll_event;
+asmlinkage long sys_oabi_epoll_ctl(int epfd, int op, int fd,
+				   struct oabi_epoll_event __user *event);
+struct oabi_sembuf;
+struct old_timespec32;
+asmlinkage long sys_oabi_semtimedop(int semid,
+				    struct oabi_sembuf __user *tsops,
+				    unsigned nsops,
+				    const struct old_timespec32 __user *timeout);
+asmlinkage long sys_oabi_semop(int semid, struct oabi_sembuf __user *tsops,
+			       unsigned nsops);
+asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third,
+			    void __user *ptr, long fifth);
+struct sockaddr;
+asmlinkage long sys_oabi_bind(int fd, struct sockaddr __user *addr, int addrlen);
+asmlinkage long sys_oabi_connect(int fd, struct sockaddr __user *addr, int addrlen);
+asmlinkage long sys_oabi_sendto(int fd, void __user *buff,
+				size_t len, unsigned flags,
+				struct sockaddr __user *addr,
+				int addrlen);
+struct user_msghdr;
+asmlinkage long sys_oabi_sendmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
+asmlinkage long sys_oabi_socketcall(int call, unsigned long __user *args);
+
+#endif
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index e07f359254c3..8d0afa11bed5 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -18,6 +18,7 @@
 #include <asm/traps.h>
 #include <asm/unistd.h>
 #include <asm/vfp.h>
+#include <asm/syscalls.h>
 
 #include "signal.h"
 
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index a5f183cfecb1..0141e9bb02e8 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -24,6 +24,7 @@
 #include <linux/ipc.h>
 #include <linux/uaccess.h>
 #include <linux/slab.h>
+#include <asm/syscalls.h>
 
 /*
  * Since loff_t is a 64 bit type we avoid a lot of ABI hassle
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index 006163195d67..d00f4040a9f5 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -10,6 +10,8 @@
  *  Copyright:	MontaVista Software, Inc.
  */
 
+#include <asm/syscalls.h>
+
 /*
  * The legacy ABI and the new ARM EABI have different rules making some
  * syscalls incompatible especially with structure arguments.
-- 
2.39.2


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

* [PATCH 15/16] ARM: decompressor: move function prototypes to misc.h
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (13 preceding siblings ...)
  2023-05-16 15:46 ` [PATCH 14/16] ARM: add missing syscall prototypes Arnd Bergmann
@ 2023-05-16 15:46 ` Arnd Bergmann
  2023-05-16 15:46 ` [PATCH 16/16] ARM: xip-kernel: add __inflate_kernel_data prototype Arnd Bergmann
  2023-05-16 19:56 ` [PATCH 00/16] ARM: address -Wmissing-prototype warnings Kees Cook
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:46 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

A number of prototypes are missing for the decompressor, some
of them are in the .c files that contain the callers, but are
invisible at the function definition:

arch/arm/boot/compressed/misc.c:129:17: error: no previous prototype for '__div0' [-Werror=missing-prototypes]
arch/arm/boot/compressed/misc.c:138:1: error: no previous prototype for 'decompress_kernel' [-Werror=missing-prototypes]
arch/arm/boot/compressed/misc.c:163:6: error: no previous prototype for 'fortify_panic' [-Werror=missing-prototypes]
arch/arm/boot/compressed/decompress.c:63:5: error: no previous prototype for 'do_decompress' [-Werror=missing-prototypes]
arch/arm/boot/compressed/fdt_check_mem_start.c:63:10: error: no previous prototype for 'fdt_check_mem_start' [-Werror=missing-prototypes]

Move these all to misc.h so they are visible by the callee as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/boot/compressed/atags_to_fdt.c        |  1 +
 arch/arm/boot/compressed/fdt_check_mem_start.c |  1 +
 arch/arm/boot/compressed/misc.c                |  6 ------
 arch/arm/boot/compressed/misc.h                | 11 +++++++++++
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c
index c579d9c42fd4..b584e091f702 100644
--- a/arch/arm/boot/compressed/atags_to_fdt.c
+++ b/arch/arm/boot/compressed/atags_to_fdt.c
@@ -2,6 +2,7 @@
 #include <linux/libfdt_env.h>
 #include <asm/setup.h>
 #include <libfdt.h>
+#include "misc.h"
 
 #if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND)
 #define do_extend_cmdline 1
diff --git a/arch/arm/boot/compressed/fdt_check_mem_start.c b/arch/arm/boot/compressed/fdt_check_mem_start.c
index 9291a2661bdf..aa856567fd33 100644
--- a/arch/arm/boot/compressed/fdt_check_mem_start.c
+++ b/arch/arm/boot/compressed/fdt_check_mem_start.c
@@ -3,6 +3,7 @@
 #include <linux/kernel.h>
 #include <linux/libfdt.h>
 #include <linux/sizes.h>
+#include "misc.h"
 
 static const void *get_prop(const void *fdt, const char *node_path,
 			    const char *property, int minlen)
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index abfed1aa2baa..6b4baa6a9a50 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -103,9 +103,6 @@ static void putstr(const char *ptr)
 /*
  * gzip declarations
  */
-extern char input_data[];
-extern char input_data_end[];
-
 unsigned char *output_data;
 
 unsigned long free_mem_ptr;
@@ -131,9 +128,6 @@ asmlinkage void __div0(void)
 	error("Attempting division by 0!");
 }
 
-extern int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x));
-
-
 void
 decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
 		unsigned long free_mem_ptr_end_p,
diff --git a/arch/arm/boot/compressed/misc.h b/arch/arm/boot/compressed/misc.h
index c958dccd1d97..6da00a26ac08 100644
--- a/arch/arm/boot/compressed/misc.h
+++ b/arch/arm/boot/compressed/misc.h
@@ -6,5 +6,16 @@
 void error(char *x) __noreturn;
 extern unsigned long free_mem_ptr;
 extern unsigned long free_mem_end_ptr;
+void __div0(void);
+void
+decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
+		  unsigned long free_mem_ptr_end_p, int arch_id);
+void fortify_panic(const char *name);
+int atags_to_fdt(void *atag_list, void *fdt, int total_space);
+uint32_t fdt_check_mem_start(uint32_t mem_start, const void *fdt);
+int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x));
+
+extern char input_data[];
+extern char input_data_end[];
 
 #endif
-- 
2.39.2


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

* [PATCH 16/16] ARM: xip-kernel: add __inflate_kernel_data prototype
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (14 preceding siblings ...)
  2023-05-16 15:46 ` [PATCH 15/16] ARM: decompressor: move function prototypes to misc.h Arnd Bergmann
@ 2023-05-16 15:46 ` Arnd Bergmann
  2023-05-16 19:56 ` [PATCH 00/16] ARM: address -Wmissing-prototype warnings Kees Cook
  16 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2023-05-16 15:46 UTC (permalink / raw)
  To: Russell King
  Cc: Arnd Bergmann, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Oleg Nesterov, Rafael J. Wysocki, Pavel Machek, Linus Walleij,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

From: Arnd Bergmann <arnd@arndb.de>

The kernel .data decompression is called from assembler, so it does
not need a prototype, but adding one avoids this W=1 warning:

arch/arm/kernel/head-inflate-data.c:35:12: error: no previous prototype for '__inflate_kernel_data' [-Werror=missing-prototypes]

The same file contains a few extern declarations for assembler
symbols, move those into the header as well for consistency.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/kernel/head-inflate-data.c | 5 +----
 arch/arm/kernel/head.h              | 8 ++++++++
 2 files changed, 9 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/kernel/head.h

diff --git a/arch/arm/kernel/head-inflate-data.c b/arch/arm/kernel/head-inflate-data.c
index 89a52104d32a..225c0699a12c 100644
--- a/arch/arm/kernel/head-inflate-data.c
+++ b/arch/arm/kernel/head-inflate-data.c
@@ -8,16 +8,13 @@
 
 #include <linux/init.h>
 #include <linux/zutil.h>
+#include "head.h"
 
 /* for struct inflate_state */
 #include "../../../lib/zlib_inflate/inftrees.h"
 #include "../../../lib/zlib_inflate/inflate.h"
 #include "../../../lib/zlib_inflate/infutil.h"
 
-extern char __data_loc[];
-extern char _edata_loc[];
-extern char _sdata[];
-
 /*
  * This code is called very early during the boot process to decompress
  * the .data segment stored compressed in ROM. Therefore none of the global
diff --git a/arch/arm/kernel/head.h b/arch/arm/kernel/head.h
new file mode 100644
index 000000000000..6eccf98fc2cc
--- /dev/null
+++ b/arch/arm/kernel/head.h
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+extern char __data_loc[];
+extern char _edata_loc[];
+extern char _sdata[];
+
+int __init __inflate_kernel_data(void);
+
-- 
2.39.2


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

* Re: [PATCH 00/16] ARM: address -Wmissing-prototype warnings
  2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
                   ` (15 preceding siblings ...)
  2023-05-16 15:46 ` [PATCH 16/16] ARM: xip-kernel: add __inflate_kernel_data prototype Arnd Bergmann
@ 2023-05-16 19:56 ` Kees Cook
  16 siblings, 0 replies; 22+ messages in thread
From: Kees Cook @ 2023-05-16 19:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Russell King, Arnd Bergmann, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, Oleg Nesterov, Rafael J. Wysocki, Pavel Machek,
	Linus Walleij, Ard Biesheuvel, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

On Tue, May 16, 2023 at 05:45:49PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> This addresses all arm specific warnings outside of the mach-*/ code,
> which I've submitted separately. The majority of the patches should be
> straightforward, either adding an #include statement to get the right
> header, or ensuring that an unused global function is left out of the
> build when the prototype is hidden.
> 
> The ones that are a bit awkward are those that just add a prototype to
> shut up the warning, but the prototypes are never used for calling the
> function because the only caller is in assembler code. I tried to come
> up with other ways to shut up the compiler, and ideally this would be
> triggered by the 'asmlinkage' keyword as Ard suggested in the past, but
> I could not come up with a way to do this.
> 
> All of the warnings have to be addressed in some form before the
> warning can be enabled by default.

Thanks! These are all long overdue. For the series:

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

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

* Re: [PATCH 05/16] ARM: kprobes: avoid missing-declaration warnings
  2023-05-16 15:45 ` [PATCH 05/16] ARM: kprobes: avoid missing-declaration warnings Arnd Bergmann
@ 2023-05-17  1:29   ` Masami Hiramatsu
  0 siblings, 0 replies; 22+ messages in thread
From: Masami Hiramatsu @ 2023-05-17  1:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Russell King, Arnd Bergmann, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, Oleg Nesterov, Rafael J. Wysocki, Pavel Machek,
	Linus Walleij, Ard Biesheuvel, Kees Cook, linux-arm-kernel,
	linux-kernel, linux-trace-kernel, linux-pm

On Tue, 16 May 2023 17:45:54 +0200
Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
> 
> checker_stack_use_t32strd() and kprobe_handler() can be made static since
> they are not used from other files, while coverage_start_registers()
> and __kprobes_test_case() are used from assembler code, and just need
> a declaration to avoid a warning with the global definition.
> 
> arch/arm/probes/kprobes/checkers-common.c:43:18: error: no previous prototype for 'checker_stack_use_t32strd'
> arch/arm/probes/kprobes/core.c:236:16: error: no previous prototype for 'kprobe_handler'
> arch/arm/probes/kprobes/test-core.c:723:10: error: no previous prototype for 'coverage_start_registers'
> arch/arm/probes/kprobes/test-core.c:918:14: error: no previous prototype for '__kprobes_test_case_start'
> arch/arm/probes/kprobes/test-core.c:952:14: error: no previous prototype for '__kprobes_test_case_end_16'
> arch/arm/probes/kprobes/test-core.c:967:14: error: no previous prototype for '__kprobes_test_case_end_32'
> 
> Fixes: 6624cf651f1a ("ARM: kprobes: collects stack consumption for store instructions")
> Fixes: 454f3e132d05 ("ARM/kprobes: Remove jprobe arm implementation")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thank you for fixing warnings!

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

> ---
>  arch/arm/probes/kprobes/checkers-common.c | 2 +-
>  arch/arm/probes/kprobes/core.c            | 2 +-
>  arch/arm/probes/kprobes/opt-arm.c         | 2 --
>  arch/arm/probes/kprobes/test-core.c       | 2 +-
>  arch/arm/probes/kprobes/test-core.h       | 4 ++++
>  5 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/probes/kprobes/checkers-common.c b/arch/arm/probes/kprobes/checkers-common.c
> index 4d720990cf2a..eba7ac4725c0 100644
> --- a/arch/arm/probes/kprobes/checkers-common.c
> +++ b/arch/arm/probes/kprobes/checkers-common.c
> @@ -40,7 +40,7 @@ enum probes_insn checker_stack_use_imm_0xx(probes_opcode_t insn,
>   * Different from other insn uses imm8, the real addressing offset of
>   * STRD in T32 encoding should be imm8 * 4. See ARMARM description.
>   */
> -enum probes_insn checker_stack_use_t32strd(probes_opcode_t insn,
> +static enum probes_insn checker_stack_use_t32strd(probes_opcode_t insn,
>  		struct arch_probes_insn *asi,
>  		const struct decode_header *h)
>  {
> diff --git a/arch/arm/probes/kprobes/core.c b/arch/arm/probes/kprobes/core.c
> index 88999ed2cfc4..3ee0e3024ff0 100644
> --- a/arch/arm/probes/kprobes/core.c
> +++ b/arch/arm/probes/kprobes/core.c
> @@ -233,7 +233,7 @@ singlestep(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb)
>   * kprobe, and that level is reserved for user kprobe handlers, so we can't
>   * risk encountering a new kprobe in an interrupt handler.
>   */
> -void __kprobes kprobe_handler(struct pt_regs *regs)
> +static void __kprobes kprobe_handler(struct pt_regs *regs)
>  {
>  	struct kprobe *p, *cur;
>  	struct kprobe_ctlblk *kcb;
> diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c
> index dbef34ed933f..7f65048380ca 100644
> --- a/arch/arm/probes/kprobes/opt-arm.c
> +++ b/arch/arm/probes/kprobes/opt-arm.c
> @@ -145,8 +145,6 @@ __arch_remove_optimized_kprobe(struct optimized_kprobe *op, int dirty)
>  	}
>  }
>  
> -extern void kprobe_handler(struct pt_regs *regs);
> -
>  static void
>  optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
>  {
> diff --git a/arch/arm/probes/kprobes/test-core.c b/arch/arm/probes/kprobes/test-core.c
> index c562832b8627..171c7076b89f 100644
> --- a/arch/arm/probes/kprobes/test-core.c
> +++ b/arch/arm/probes/kprobes/test-core.c
> @@ -720,7 +720,7 @@ static const char coverage_register_lookup[16] = {
>  	[REG_TYPE_NOSPPCX]	= COVERAGE_ANY_REG | COVERAGE_SP,
>  };
>  
> -unsigned coverage_start_registers(const struct decode_header *h)
> +static unsigned coverage_start_registers(const struct decode_header *h)
>  {
>  	unsigned regs = 0;
>  	int i;
> diff --git a/arch/arm/probes/kprobes/test-core.h b/arch/arm/probes/kprobes/test-core.h
> index 56ad3c0aaeea..c7297037c162 100644
> --- a/arch/arm/probes/kprobes/test-core.h
> +++ b/arch/arm/probes/kprobes/test-core.h
> @@ -454,3 +454,7 @@ void kprobe_thumb32_test_cases(void);
>  #else
>  void kprobe_arm_test_cases(void);
>  #endif
> +
> +void __kprobes_test_case_start(void);
> +void __kprobes_test_case_end_16(void);
> +void __kprobes_test_case_end_32(void);
> -- 
> 2.39.2
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

* Re: [PATCH 13/16] ARM: vfp: add vfp_entry prototype
  2023-05-16 15:46 ` [PATCH 13/16] ARM: vfp: add vfp_entry prototype Arnd Bergmann
@ 2023-05-17 11:13   ` Ard Biesheuvel
  0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2023-05-17 11:13 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Russell King, Arnd Bergmann, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, Oleg Nesterov, Rafael J. Wysocki, Pavel Machek,
	Linus Walleij, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

On Tue, 16 May 2023 at 17:47, Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> vfp_entry is only called from assembler code, so it does not
> need a declaration. Since gcc complains when extra warnings
> are enabled, add one anyway to avoid:
>
> arch/arm/vfp/vfpmodule.c:657:17: warning: no previous prototype for function 'vfp_entry' [-Wmissing-prototypes]
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

This one will conflict with my VFP asm to C conversion series.

> ---
>  arch/arm/vfp/vfp.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h
> index 5cd6d5053271..10d9c0da0fd4 100644
> --- a/arch/arm/vfp/vfp.h
> +++ b/arch/arm/vfp/vfp.h
> @@ -375,3 +375,6 @@ struct op {
>  };
>
>  asmlinkage void vfp_save_state(void *location, u32 fpexc);
> +struct thread_info;
> +asmlinkage void vfp_entry(u32 trigger, struct thread_info *ti, u32 resume_pc,
> +                         u32 resume_return_address);
> --
> 2.39.2
>

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

* Re: [PATCH 06/16] ARM: tcm: move tcm_init() prototype to asm/tcm.h
  2023-05-16 15:45 ` [PATCH 06/16] ARM: tcm: move tcm_init() prototype to asm/tcm.h Arnd Bergmann
@ 2023-05-22  7:34   ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2023-05-22  7:34 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Russell King, Arnd Bergmann, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, Oleg Nesterov, Rafael J. Wysocki, Pavel Machek,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

On Tue, May 16, 2023 at 5:46 PM Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
>
> The function definition is in a file that does not include the
> header with the declaration:
>
> arch/arm/kernel/tcm.c:256:13: error: no previous prototype for 'tcm_init'
>
> Move the declaration to a global header where it can actually be
> included.
>
> Fixes: de40614e92bf ("ARM: 7694/1: ARM, TCM: initialize TCM in paging_init(), instead of setup_arch()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH 11/16] ARM: move setup functions to header
  2023-05-16 15:46 ` [PATCH 11/16] ARM: move setup functions to header Arnd Bergmann
@ 2023-05-22  7:35   ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2023-05-22  7:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Russell King, Arnd Bergmann, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, Oleg Nesterov, Rafael J. Wysocki, Pavel Machek,
	Ard Biesheuvel, Kees Cook, linux-arm-kernel, linux-kernel,
	linux-trace-kernel, linux-pm

On Tue, May 16, 2023 at 5:46 PM Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
>
> A couple of functions are declared in arch/arm/mm/mmu.c rather than in a header,
> which causes W=1 build warnings:
>
> arch/arm/mm/init.c:97:13: error: no previous prototype for 'setup_dma_zone' [-Werror=missing-prototypes]
> arch/arm/mm/mmu.c:118:13: error: no previous prototype for 'init_default_cache_policy' [-Werror=missing-prototypes]
> arch/arm/mm/mmu.c:1195:13: error: no previous prototype for 'adjust_lowmem_bounds' [-Werror=missing-prototypes]
> arch/arm/mm/mmu.c:1761:13: error: no previous prototype for 'paging_init' [-Werror=missing-prototypes]
> arch/arm/mm/mmu.c:1794:13: error: no previous prototype for 'early_mm_init' [-Werror=missing-prototypes]
>
> Move the declaratsion to asm/setup.h so they can be seen by the compiler
> while building the definition.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

This looks cleaner to me:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

end of thread, other threads:[~2023-05-22  7:36 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-16 15:45 [PATCH 00/16] ARM: address -Wmissing-prototype warnings Arnd Bergmann
2023-05-16 15:45 ` [PATCH 01/16] ARM: dma-mapping: hide unused dma_contiguous_early_fixup function Arnd Bergmann
2023-05-16 15:45 ` [PATCH 02/16] ARM: traps: hide unused functions on NOMMU Arnd Bergmann
2023-05-16 15:45 ` [PATCH 03/16] ARM: vfp: include asm/neon.h in vfpmodule.c Arnd Bergmann
2023-05-16 15:45 ` [PATCH 04/16] ARM: vdso: add missing prototypes Arnd Bergmann
2023-05-16 15:45 ` [PATCH 05/16] ARM: kprobes: avoid missing-declaration warnings Arnd Bergmann
2023-05-17  1:29   ` Masami Hiramatsu
2023-05-16 15:45 ` [PATCH 06/16] ARM: tcm: move tcm_init() prototype to asm/tcm.h Arnd Bergmann
2023-05-22  7:34   ` Linus Walleij
2023-05-16 15:45 ` [PATCH 07/16] ARM: add prototype for function called only from asm Arnd Bergmann
2023-05-16 15:45 ` [PATCH 08/16] ARM: add clear/copy_user_highpage declarations Arnd Bergmann
2023-05-16 15:45 ` [PATCH 09/16] ARM: cacheflush: avoid __flush_anon_page() missing-prototype warning Arnd Bergmann
2023-05-16 15:45 ` [PATCH 10/16] ARM: nommu: include asm/idmap.h Arnd Bergmann
2023-05-16 15:46 ` [PATCH 11/16] ARM: move setup functions to header Arnd Bergmann
2023-05-22  7:35   ` Linus Walleij
2023-05-16 15:46 ` [PATCH 12/16] ARM: fiq: include asm/mach/irq.h for prototypes Arnd Bergmann
2023-05-16 15:46 ` [PATCH 13/16] ARM: vfp: add vfp_entry prototype Arnd Bergmann
2023-05-17 11:13   ` Ard Biesheuvel
2023-05-16 15:46 ` [PATCH 14/16] ARM: add missing syscall prototypes Arnd Bergmann
2023-05-16 15:46 ` [PATCH 15/16] ARM: decompressor: move function prototypes to misc.h Arnd Bergmann
2023-05-16 15:46 ` [PATCH 16/16] ARM: xip-kernel: add __inflate_kernel_data prototype Arnd Bergmann
2023-05-16 19:56 ` [PATCH 00/16] ARM: address -Wmissing-prototype warnings Kees Cook

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).