Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: jump_label: mark arguments as const to satisfy asm constraints

Inspired by x86 commit 864b435514b2("x86/jump_label: Mark arguments as
const to satisfy asm constraints"), mark arch_static_branch()'s and
arch_static_branch_jump()'s arguments as const to satisfy asm
constraints. And Steven in [1] also pointed out that "The "i"
constraint needs to be a constant."

Tested with building a simple external kernel module with "O0".

[1]https://lore.kernel.org/all/20210212094059.5f8d05e8@gandalf.local.home/

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Link: https://lore.kernel.org/r/20221006075542.2658-2-jszhang@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Jisheng Zhang and committed by
Will Deacon
efbc9578 f0c4d9fc

+4 -4
+4 -4
arch/arm64/include/asm/jump_label.h
··· 15 15 16 16 #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE 17 17 18 - static __always_inline bool arch_static_branch(struct static_key *key, 19 - bool branch) 18 + static __always_inline bool arch_static_branch(struct static_key * const key, 19 + const bool branch) 20 20 { 21 21 asm_volatile_goto( 22 22 "1: nop \n\t" ··· 32 32 return true; 33 33 } 34 34 35 - static __always_inline bool arch_static_branch_jump(struct static_key *key, 36 - bool branch) 35 + static __always_inline bool arch_static_branch_jump(struct static_key * const key, 36 + const bool branch) 37 37 { 38 38 asm_volatile_goto( 39 39 "1: b %l[l_yes] \n\t"