Commit 3a2bfec0 authored by Li kunyu's avatar Li kunyu Committed by Steven Rostedt (Google)

ftrace: Remove return value of ftrace_arch_modify_*()

All instances of the function ftrace_arch_modify_prepare() and
  ftrace_arch_modify_post_process() return zero. There's no point in
  checking their return value. Just have them be void functions.

Link: https://lkml.kernel.org/r/20220518023639.4065-1-kunyu@nfschina.comSigned-off-by: default avatarLi kunyu <kunyu@nfschina.com>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent 2decd16f
...@@ -79,16 +79,14 @@ static unsigned long __ref adjust_address(struct dyn_ftrace *rec, ...@@ -79,16 +79,14 @@ static unsigned long __ref adjust_address(struct dyn_ftrace *rec,
return (unsigned long)&ftrace_regs_caller_from_init; return (unsigned long)&ftrace_regs_caller_from_init;
} }
int ftrace_arch_code_modify_prepare(void) void ftrace_arch_code_modify_prepare(void)
{ {
return 0;
} }
int ftrace_arch_code_modify_post_process(void) void ftrace_arch_code_modify_post_process(void)
{ {
/* Make sure any TLB misses during machine stop are cleared. */ /* Make sure any TLB misses during machine stop are cleared. */
flush_tlb_all(); flush_tlb_all();
return 0;
} }
static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr, static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr,
......
...@@ -12,16 +12,14 @@ ...@@ -12,16 +12,14 @@
#include <asm/patch.h> #include <asm/patch.h>
#ifdef CONFIG_DYNAMIC_FTRACE #ifdef CONFIG_DYNAMIC_FTRACE
int ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex) void ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex)
{ {
mutex_lock(&text_mutex); mutex_lock(&text_mutex);
return 0;
} }
int ftrace_arch_code_modify_post_process(void) __releases(&text_mutex) void ftrace_arch_code_modify_post_process(void) __releases(&text_mutex)
{ {
mutex_unlock(&text_mutex); mutex_unlock(&text_mutex);
return 0;
} }
static int ftrace_check_current_call(unsigned long hook_pos, static int ftrace_check_current_call(unsigned long hook_pos,
......
...@@ -225,14 +225,13 @@ void arch_ftrace_update_code(int command) ...@@ -225,14 +225,13 @@ void arch_ftrace_update_code(int command)
ftrace_modify_all_code(command); ftrace_modify_all_code(command);
} }
int ftrace_arch_code_modify_post_process(void) void ftrace_arch_code_modify_post_process(void)
{ {
/* /*
* Flush any pre-fetched instructions on all * Flush any pre-fetched instructions on all
* CPUs to make the new code visible. * CPUs to make the new code visible.
*/ */
text_poke_sync_lock(); text_poke_sync_lock();
return 0;
} }
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
static int ftrace_poke_late = 0; static int ftrace_poke_late = 0;
int ftrace_arch_code_modify_prepare(void) void ftrace_arch_code_modify_prepare(void)
__acquires(&text_mutex) __acquires(&text_mutex)
{ {
/* /*
...@@ -47,10 +47,9 @@ int ftrace_arch_code_modify_prepare(void) ...@@ -47,10 +47,9 @@ int ftrace_arch_code_modify_prepare(void)
*/ */
mutex_lock(&text_mutex); mutex_lock(&text_mutex);
ftrace_poke_late = 1; ftrace_poke_late = 1;
return 0;
} }
int ftrace_arch_code_modify_post_process(void) void ftrace_arch_code_modify_post_process(void)
__releases(&text_mutex) __releases(&text_mutex)
{ {
/* /*
...@@ -61,7 +60,6 @@ int ftrace_arch_code_modify_post_process(void) ...@@ -61,7 +60,6 @@ int ftrace_arch_code_modify_post_process(void)
text_poke_finish(); text_poke_finish();
ftrace_poke_late = 0; ftrace_poke_late = 0;
mutex_unlock(&text_mutex); mutex_unlock(&text_mutex);
return 0;
} }
static const char *ftrace_nop_replace(void) static const char *ftrace_nop_replace(void)
......
...@@ -449,8 +449,8 @@ static inline void stack_tracer_enable(void) { } ...@@ -449,8 +449,8 @@ static inline void stack_tracer_enable(void) { }
#ifdef CONFIG_DYNAMIC_FTRACE #ifdef CONFIG_DYNAMIC_FTRACE
int ftrace_arch_code_modify_prepare(void); void ftrace_arch_code_modify_prepare(void);
int ftrace_arch_code_modify_post_process(void); void ftrace_arch_code_modify_post_process(void);
enum ftrace_bug_type { enum ftrace_bug_type {
FTRACE_BUG_UNKNOWN, FTRACE_BUG_UNKNOWN,
......
...@@ -2704,18 +2704,16 @@ ftrace_nop_initialize(struct module *mod, struct dyn_ftrace *rec) ...@@ -2704,18 +2704,16 @@ ftrace_nop_initialize(struct module *mod, struct dyn_ftrace *rec)
* archs can override this function if they must do something * archs can override this function if they must do something
* before the modifying code is performed. * before the modifying code is performed.
*/ */
int __weak ftrace_arch_code_modify_prepare(void) void __weak ftrace_arch_code_modify_prepare(void)
{ {
return 0;
} }
/* /*
* archs can override this function if they must do something * archs can override this function if they must do something
* after the modifying code is performed. * after the modifying code is performed.
*/ */
int __weak ftrace_arch_code_modify_post_process(void) void __weak ftrace_arch_code_modify_post_process(void)
{ {
return 0;
} }
void ftrace_modify_all_code(int command) void ftrace_modify_all_code(int command)
...@@ -2801,12 +2799,7 @@ void __weak arch_ftrace_update_code(int command) ...@@ -2801,12 +2799,7 @@ void __weak arch_ftrace_update_code(int command)
static void ftrace_run_update_code(int command) static void ftrace_run_update_code(int command)
{ {
int ret; ftrace_arch_code_modify_prepare();
ret = ftrace_arch_code_modify_prepare();
FTRACE_WARN_ON(ret);
if (ret)
return;
/* /*
* By default we use stop_machine() to modify the code. * By default we use stop_machine() to modify the code.
...@@ -2816,8 +2809,7 @@ static void ftrace_run_update_code(int command) ...@@ -2816,8 +2809,7 @@ static void ftrace_run_update_code(int command)
*/ */
arch_ftrace_update_code(command); arch_ftrace_update_code(command);
ret = ftrace_arch_code_modify_post_process(); ftrace_arch_code_modify_post_process();
FTRACE_WARN_ON(ret);
} }
static void ftrace_run_modify_code(struct ftrace_ops *ops, int command, static void ftrace_run_modify_code(struct ftrace_ops *ops, int command,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment