Skip to content

Commit b80b3d5

Browse files
zongboxpalmer-dabbelt
authored andcommitted
riscv: Remove the 'riscv_' prefix of function name
Refactor the function name by removing the 'riscv_' prefix, it would be better unless it could mix up with arch-independent functions. Signed-off-by: Zong Li <[email protected]> Reviewed-by: Masami Hiramatsu <[email protected]> Reviewed-by: Palmer Dabbelt <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent edde558 commit b80b3d5

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

arch/riscv/include/asm/patch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifndef _ASM_RISCV_PATCH_H
77
#define _ASM_RISCV_PATCH_H
88

9-
int riscv_patch_text_nosync(void *addr, const void *insns, size_t len);
10-
int riscv_patch_text(void *addr, u32 insn);
9+
int patch_text_nosync(void *addr, const void *insns, size_t len);
10+
int patch_text(void *addr, u32 insn);
1111

1212
#endif /* _ASM_RISCV_PATCH_H */

arch/riscv/kernel/ftrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static int __ftrace_modify_call(unsigned long hook_pos, unsigned long target,
5151
make_call(hook_pos, target, call);
5252

5353
/* Replace the auipc-jalr pair at once. Return -EPERM on write error. */
54-
if (riscv_patch_text_nosync
54+
if (patch_text_nosync
5555
((void *)hook_pos, enable ? call : nops, MCOUNT_INSN_SIZE))
5656
return -EPERM;
5757

arch/riscv/kernel/patch.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <asm/cacheflush.h>
1212
#include <asm/fixmap.h>
1313

14-
struct riscv_insn_patch {
14+
struct patch_insn {
1515
void *addr;
1616
u32 insn;
1717
atomic_t cpu_count;
@@ -43,7 +43,7 @@ static void __kprobes patch_unmap(int fixmap)
4343
clear_fixmap(fixmap);
4444
}
4545

46-
static int __kprobes riscv_insn_write(void *addr, const void *insn, size_t len)
46+
static int __kprobes patch_insn_write(void *addr, const void *insn, size_t len)
4747
{
4848
void *waddr = addr;
4949
bool across_pages = (((uintptr_t) addr & ~PAGE_MASK) + len) > PAGE_SIZE;
@@ -69,33 +69,33 @@ static int __kprobes riscv_insn_write(void *addr, const void *insn, size_t len)
6969
return ret;
7070
}
7171
#else
72-
static int __kprobes riscv_insn_write(void *addr, const void *insn, size_t len)
72+
static int __kprobes patch_insn_write(void *addr, const void *insn, size_t len)
7373
{
7474
return probe_kernel_write(addr, insn, len);
7575
}
7676
#endif /* CONFIG_MMU */
7777

78-
int __kprobes riscv_patch_text_nosync(void *addr, const void *insns, size_t len)
78+
int __kprobes patch_text_nosync(void *addr, const void *insns, size_t len)
7979
{
8080
u32 *tp = addr;
8181
int ret;
8282

83-
ret = riscv_insn_write(tp, insns, len);
83+
ret = patch_insn_write(tp, insns, len);
8484

8585
if (!ret)
8686
flush_icache_range((uintptr_t) tp, (uintptr_t) tp + len);
8787

8888
return ret;
8989
}
9090

91-
static int __kprobes riscv_patch_text_cb(void *data)
91+
static int __kprobes patch_text_cb(void *data)
9292
{
93-
struct riscv_insn_patch *patch = data;
93+
struct patch_insn *patch = data;
9494
int ret = 0;
9595

9696
if (atomic_inc_return(&patch->cpu_count) == 1) {
9797
ret =
98-
riscv_patch_text_nosync(patch->addr, &patch->insn,
98+
patch_text_nosync(patch->addr, &patch->insn,
9999
GET_INSN_LENGTH(patch->insn));
100100
atomic_inc(&patch->cpu_count);
101101
} else {
@@ -107,14 +107,14 @@ static int __kprobes riscv_patch_text_cb(void *data)
107107
return ret;
108108
}
109109

110-
int __kprobes riscv_patch_text(void *addr, u32 insn)
110+
int __kprobes patch_text(void *addr, u32 insn)
111111
{
112-
struct riscv_insn_patch patch = {
112+
struct patch_insn patch = {
113113
.addr = addr,
114114
.insn = insn,
115115
.cpu_count = ATOMIC_INIT(0),
116116
};
117117

118-
return stop_machine_cpuslocked(riscv_patch_text_cb,
118+
return stop_machine_cpuslocked(patch_text_cb,
119119
&patch, cpu_online_mask);
120120
}

0 commit comments

Comments
 (0)