jump_label: make initial NOP patching the special case
[linux-2.6-block.git] / arch / arm / kernel / jump_label.c
CommitLineData
b2441318 1// SPDX-License-Identifier: GPL-2.0
09f05d85
RV
2#include <linux/kernel.h>
3#include <linux/jump_label.h>
fca08f32 4#include <asm/patch.h>
0dc016db 5#include <asm/insn.h>
09f05d85 6
09f05d85
RV
7static void __arch_jump_label_transform(struct jump_entry *entry,
8 enum jump_label_type type,
9 bool is_static)
10{
11 void *addr = (void *)entry->code;
12 unsigned int insn;
13
76b235c6 14 if (type == JUMP_LABEL_JMP)
09f05d85
RV
15 insn = arm_gen_branch(entry->code, entry->target);
16 else
17 insn = arm_gen_nop();
18
19 if (is_static)
ab0615e2 20 __patch_text_early(addr, insn);
09f05d85
RV
21 else
22 patch_text(addr, insn);
23}
24
25void arch_jump_label_transform(struct jump_entry *entry,
26 enum jump_label_type type)
27{
28 __arch_jump_label_transform(entry, type, false);
29}