diff options
author | Anders Roxell <anders.roxell@linaro.org> | 2015-03-20 21:03:53 +0100 |
---|---|---|
committer | Anders Roxell <anders.roxell@linaro.org> | 2015-03-20 21:03:53 +0100 |
commit | e20e8b472345ea5babd805db6726d1a7000f7673 (patch) | |
tree | 1aaff25991578806a867ba3efcb0f7fd59940388 /include/linux/jump_label.h | |
parent | 588956edf5bb33741de41687677f21f5c37671da (diff) | |
parent | c59ecb2edfc11b725a0fa4cb5420c4dbae482c17 (diff) |
Merge tag 'v3.14.36-rt31-lno1' into linux-linaro-lsk-v3.14-rt
Linux 3.14.36-rt31
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Conflicts:
arch/arm64/kernel/setup.c
arch/x86/kernel/traps.c
Diffstat (limited to 'include/linux/jump_label.h')
-rw-r--r-- | include/linux/jump_label.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index 9ab0b5915fde..52e24d4a8aad 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -70,6 +70,10 @@ struct static_key { # include <asm/jump_label.h> # define HAVE_JUMP_LABEL +#else +struct static_key { + atomic_t enabled; +}; #endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ enum jump_label_type { @@ -80,6 +84,12 @@ enum jump_label_type { struct module; #include <linux/atomic.h> + +static inline int static_key_count(struct static_key *key) +{ + return atomic_read(&key->enabled); +} + #ifdef HAVE_JUMP_LABEL #define JUMP_LABEL_TYPE_FALSE_BRANCH 0UL @@ -135,10 +145,6 @@ extern void jump_label_apply_nops(struct module *mod); #else /* !HAVE_JUMP_LABEL */ -struct static_key { - atomic_t enabled; -}; - static __always_inline void jump_label_init(void) { static_key_initialized = true; @@ -146,14 +152,14 @@ static __always_inline void jump_label_init(void) static __always_inline bool static_key_false(struct static_key *key) { - if (unlikely(atomic_read(&key->enabled) > 0)) + if (unlikely(static_key_count(key) > 0)) return true; return false; } static __always_inline bool static_key_true(struct static_key *key) { - if (likely(atomic_read(&key->enabled) > 0)) + if (likely(static_key_count(key) > 0)) return true; return false; } @@ -195,7 +201,7 @@ static inline int jump_label_apply_nops(struct module *mod) static inline bool static_key_enabled(struct static_key *key) { - return (atomic_read(&key->enabled) > 0); + return static_key_count(key) > 0; } #endif /* _LINUX_JUMP_LABEL_H */ |