treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / arm64 / include / asm / jump_label.h
blobcea441b6aa5dc63317f595a04eb745c4f0b3b8d7
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2013 Huawei Ltd.
4 * Author: Jiang Liu <liuj97@gmail.com>
6 * Based on arch/arm/include/asm/jump_label.h
7 */
8 #ifndef __ASM_JUMP_LABEL_H
9 #define __ASM_JUMP_LABEL_H
11 #ifndef __ASSEMBLY__
13 #include <linux/types.h>
14 #include <asm/insn.h>
16 #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
18 static __always_inline bool arch_static_branch(struct static_key *key,
19 bool branch)
21 asm_volatile_goto(
22 "1: nop \n\t"
23 " .pushsection __jump_table, \"aw\" \n\t"
24 " .align 3 \n\t"
25 " .long 1b - ., %l[l_yes] - . \n\t"
26 " .quad %c0 - . \n\t"
27 " .popsection \n\t"
28 : : "i"(&((char *)key)[branch]) : : l_yes);
30 return false;
31 l_yes:
32 return true;
35 static __always_inline bool arch_static_branch_jump(struct static_key *key,
36 bool branch)
38 asm_volatile_goto(
39 "1: b %l[l_yes] \n\t"
40 " .pushsection __jump_table, \"aw\" \n\t"
41 " .align 3 \n\t"
42 " .long 1b - ., %l[l_yes] - . \n\t"
43 " .quad %c0 - . \n\t"
44 " .popsection \n\t"
45 : : "i"(&((char *)key)[branch]) : : l_yes);
47 return false;
48 l_yes:
49 return true;
52 #endif /* __ASSEMBLY__ */
53 #endif /* __ASM_JUMP_LABEL_H */