mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
[ Upstream commit ca8e45c8048a2c9503c74751d25414601f730580 ] The arch_jump_label_transform_static() function in csky was originally meant to override the generic __weak function, but that got changed to an #ifndef check. This showed up as a missing-prototype warning: arch/csky/kernel/jump_label.c:43:6: error: no previous prototype for 'arch_jump_label_transform_static' [-Werror=missing-prototypes] Change the method to use the new method of having a #define and a prototype for the global function. Fixes:7e6b9db27d("jump_label: make initial NOP patching the special case") Fixes:4e8bb4ba5a("csky: Add jump-label implementation") Reviewed-by: Guo Ren <guoren@kernel.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
53 lines
1.2 KiB
C
53 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
#ifndef __ASM_CSKY_JUMP_LABEL_H
|
|
#define __ASM_CSKY_JUMP_LABEL_H
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/types.h>
|
|
|
|
#define JUMP_LABEL_NOP_SIZE 4
|
|
|
|
static __always_inline bool arch_static_branch(struct static_key *key,
|
|
bool branch)
|
|
{
|
|
asm_volatile_goto(
|
|
"1: nop32 \n"
|
|
" .pushsection __jump_table, \"aw\" \n"
|
|
" .align 2 \n"
|
|
" .long 1b - ., %l[label] - . \n"
|
|
" .long %0 - . \n"
|
|
" .popsection \n"
|
|
: : "i"(&((char *)key)[branch]) : : label);
|
|
|
|
return false;
|
|
label:
|
|
return true;
|
|
}
|
|
|
|
static __always_inline bool arch_static_branch_jump(struct static_key *key,
|
|
bool branch)
|
|
{
|
|
asm_volatile_goto(
|
|
"1: bsr32 %l[label] \n"
|
|
" .pushsection __jump_table, \"aw\" \n"
|
|
" .align 2 \n"
|
|
" .long 1b - ., %l[label] - . \n"
|
|
" .long %0 - . \n"
|
|
" .popsection \n"
|
|
: : "i"(&((char *)key)[branch]) : : label);
|
|
|
|
return false;
|
|
label:
|
|
return true;
|
|
}
|
|
|
|
enum jump_label_type;
|
|
void arch_jump_label_transform_static(struct jump_entry *entry,
|
|
enum jump_label_type type);
|
|
#define arch_jump_label_transform_static arch_jump_label_transform_static
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
#endif /* __ASM_CSKY_JUMP_LABEL_H */
|