[PATCH v2 13/52] m68k: mm: Add and use "fault.h"

From: Geert Uytterhoeven
Date: Wed Sep 13 2023 - 10:08:55 EST


When building with W=1:

arch/m68k/mm/fault.c:22:5: warning: no previous prototype for ‘send_fault_sig’ [-Wmissing-prototypes]
22 | int send_fault_sig(struct pt_regs *regs)
| ^~~~~~~~~~~~~~
arch/m68k/mm/fault.c:68:5: warning: no previous prototype for ‘do_page_fault’ [-Wmissing-prototypes]
68 | int do_page_fault(struct pt_regs *regs, unsigned long address,
| ^~~~~~~~~~~~~

Fix this by introducing a new header file "fault.h" for holding the
prototypes of functions implemented in arch/m68k/mm/fault.c.

Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Acked-by: Arnd Bergmann <arnd@xxxxxxxx>
---
v2:
- Add Acked-by.
---
arch/m68k/kernel/sys_m68k.c | 3 +--
arch/m68k/kernel/traps.c | 5 +----
arch/m68k/mm/fault.c | 2 ++
arch/m68k/mm/fault.h | 7 +++++++
4 files changed, 11 insertions(+), 6 deletions(-)
create mode 100644 arch/m68k/mm/fault.h

diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 14055d676161d725..1af5e60824676bf3 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -35,8 +35,7 @@

#include <asm/tlb.h>

-asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
- unsigned long error_code);
+#include "../mm/fault.h"

asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index d408334712f7118b..129c89349e1a40aa 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -42,6 +42,7 @@
#include <asm/tlbflush.h>

#include "traps.h"
+#include "../mm/fault.h"

static const char *vec_names[] = {
[VEC_RESETSP] = "RESET SP",
@@ -126,10 +127,6 @@ static const char *space_names[] = {
};

void die_if_kernel(char *,struct pt_regs *,int);
-asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
- unsigned long error_code);
-int send_fault_sig(struct pt_regs *regs);
-
asmlinkage void trap_c(struct frame *fp);

#if defined (CONFIG_M68060)
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index c290c5c0cfb93a81..fa3c5f38d9894c08 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -17,6 +17,8 @@
#include <asm/setup.h>
#include <asm/traps.h>

+#include "fault.h"
+
extern void die_if_kernel(char *, struct pt_regs *, long);

int send_fault_sig(struct pt_regs *regs)
diff --git a/arch/m68k/mm/fault.h b/arch/m68k/mm/fault.h
new file mode 100644
index 0000000000000000..dab14ef7d4a171d5
--- /dev/null
+++ b/arch/m68k/mm/fault.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+struct pt_regs;
+
+int do_page_fault(struct pt_regs *regs, unsigned long address,
+ unsigned long error_code);
+int send_fault_sig(struct pt_regs *regs);
--
2.34.1