Skip to content

Commit a26ce42

Browse files
rnavmpe
authored andcommitted
powerpc/ftrace: Replace use of ftrace_call_replace() with ftrace_create_branch_inst()
ftrace_create_branch_inst() is clearer about its intent than ftrace_call_replace(). Signed-off-by: Naveen N Rao <naveen@kernel.org> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/953513b88fa922ba7a66d772dc1310710efe9177.1687166935.git.naveen@kernel.org
1 parent 6738573 commit a26ce42

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

arch/powerpc/kernel/trace/ftrace.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,6 @@ static ppc_inst_t ftrace_create_branch_inst(unsigned long ip, unsigned long addr
4141
return op;
4242
}
4343

44-
static ppc_inst_t
45-
ftrace_call_replace(unsigned long ip, unsigned long addr, int link)
46-
{
47-
ppc_inst_t op;
48-
49-
addr = ppc_function_entry((void *)addr);
50-
51-
/* if (link) set op to 'bl' else 'b' */
52-
create_branch(&op, (u32 *)ip, addr, link ? BRANCH_SET_LINK : 0);
53-
54-
return op;
55-
}
56-
5744
static inline int ftrace_read_inst(unsigned long ip, ppc_inst_t *op)
5845
{
5946
if (copy_inst_from_kernel_nofault(op, (void *)ip)) {
@@ -275,14 +262,14 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
275262
int ret;
276263

277264
old = ppc_inst_read((u32 *)&ftrace_call);
278-
new = ftrace_call_replace(ip, (unsigned long)func, 1);
265+
new = ftrace_create_branch_inst(ip, ppc_function_entry(func), 1);
279266
ret = ftrace_modify_code(ip, old, new);
280267

281268
/* Also update the regs callback function */
282269
if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS) && !ret) {
283270
ip = (unsigned long)(&ftrace_regs_call);
284271
old = ppc_inst_read((u32 *)&ftrace_regs_call);
285-
new = ftrace_call_replace(ip, (unsigned long)func, 1);
272+
new = ftrace_create_branch_inst(ip, ppc_function_entry(func), 1);
286273
ret = ftrace_modify_code(ip, old, new);
287274
}
288275

0 commit comments

Comments
 (0)