diff mbox series

[2/4] MIPS: move FTRACE_SYSCALLS from ftrace.c into syscall.c

Message ID 20210305101933.9799-3-huangpei@loongson.cn (mailing list archive)
State Superseded
Headers show
Series [1/4] MIPS: replace -pg with CC_FLAGS_FTRACE | expand

Commit Message

Huang Pei March 5, 2021, 10:19 a.m. UTC
Signed-off-by: Huang Pei <huangpei@loongson.cn>
---
 arch/mips/kernel/Makefile  |  1 -
 arch/mips/kernel/ftrace.c  | 33 ---------------------------------
 arch/mips/kernel/syscall.c | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 32 insertions(+), 34 deletions(-)
diff mbox series

Patch

diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 33e31ea10234..5b2b551058ac 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -39,7 +39,6 @@  obj-$(CONFIG_DEBUG_FS)		+= segment.o
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 obj-$(CONFIG_MODULES)		+= module.o
 
-obj-$(CONFIG_FTRACE_SYSCALLS)	+= ftrace.o
 obj-$(CONFIG_FUNCTION_TRACER)	+= mcount.o ftrace.o
 
 sw-y				:= r4k_switch.o
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index f57e68f40a34..5156b2e54bfe 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -12,14 +12,11 @@ 
 #include <linux/uaccess.h>
 #include <linux/init.h>
 #include <linux/ftrace.h>
-#include <linux/syscalls.h>
 
 #include <asm/asm.h>
 #include <asm/asm-offsets.h>
 #include <asm/cacheflush.h>
-#include <asm/syscall.h>
 #include <asm/uasm.h>
-#include <asm/unistd.h>
 
 #include <asm-generic/sections.h>
 
@@ -382,33 +379,3 @@  void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
 	WARN_ON(1);
 }
 #endif	/* CONFIG_FUNCTION_GRAPH_TRACER */
-
-#ifdef CONFIG_FTRACE_SYSCALLS
-
-#ifdef CONFIG_32BIT
-unsigned long __init arch_syscall_addr(int nr)
-{
-	return (unsigned long)sys_call_table[nr - __NR_O32_Linux];
-}
-#endif
-
-#ifdef CONFIG_64BIT
-
-unsigned long __init arch_syscall_addr(int nr)
-{
-#ifdef CONFIG_MIPS32_N32
-	if (nr >= __NR_N32_Linux && nr < __NR_N32_Linux + __NR_N32_Linux_syscalls)
-		return (unsigned long)sysn32_call_table[nr - __NR_N32_Linux];
-#endif
-	if (nr >= __NR_64_Linux  && nr < __NR_64_Linux + __NR_64_Linux_syscalls)
-		return (unsigned long)sys_call_table[nr - __NR_64_Linux];
-#ifdef CONFIG_MIPS32_O32
-	if (nr >= __NR_O32_Linux && nr < __NR_O32_Linux + __NR_O32_Linux_syscalls)
-		return (unsigned long)sys32_call_table[nr - __NR_O32_Linux];
-#endif
-
-	return (unsigned long) &sys_ni_syscall;
-}
-#endif
-
-#endif /* CONFIG_FTRACE_SYSCALLS */
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 2afa3eef486a..797d9ce478da 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -39,7 +39,9 @@ 
 #include <asm/shmparam.h>
 #include <asm/sync.h>
 #include <asm/sysmips.h>
+#include <asm/syscall.h>
 #include <asm/switch_to.h>
+#include <asm/unistd.h>
 
 /*
  * For historic reasons the pipe(2) syscall on MIPS has an unusual calling
@@ -233,6 +235,36 @@  SYSCALL_DEFINE3(sysmips, long, cmd, long, arg1, long, arg2)
 	return -EINVAL;
 }
 
+#ifdef CONFIG_FTRACE_SYSCALLS
+
+#ifdef CONFIG_32BIT
+unsigned long __init arch_syscall_addr(int nr)
+{
+	return (unsigned long)sys_call_table[nr - __NR_O32_Linux];
+}
+#endif
+
+#ifdef CONFIG_64BIT
+
+unsigned long __init arch_syscall_addr(int nr)
+{
+#ifdef CONFIG_MIPS32_N32
+	if (nr >= __NR_N32_Linux && nr < __NR_N32_Linux + __NR_N32_Linux_syscalls)
+		return (unsigned long)sysn32_call_table[nr - __NR_N32_Linux];
+#endif
+	if (nr >= __NR_64_Linux  && nr < __NR_64_Linux + __NR_64_Linux_syscalls)
+		return (unsigned long)sys_call_table[nr - __NR_64_Linux];
+#ifdef CONFIG_MIPS32_O32
+	if (nr >= __NR_O32_Linux && nr < __NR_O32_Linux + __NR_O32_Linux_syscalls)
+		return (unsigned long)sys32_call_table[nr - __NR_O32_Linux];
+#endif
+
+	return (unsigned long) &sys_ni_syscall;
+}
+#endif
+
+#endif /* CONFIG_FTRACE_SYSCALLS */
+
 /*
  * No implemented yet ...
  */