aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/jump_label.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/jump_label.h')
-rw-r--r--include/linux/jump_label.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index f1094238ab2a..8dde55974f18 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -214,11 +214,6 @@ static inline int jump_label_apply_nops(struct module *mod)
214#define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE 214#define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE
215#define jump_label_enabled static_key_enabled 215#define jump_label_enabled static_key_enabled
216 216
217static inline bool static_key_enabled(struct static_key *key)
218{
219 return static_key_count(key) > 0;
220}
221
222static inline void static_key_enable(struct static_key *key) 217static inline void static_key_enable(struct static_key *key)
223{ 218{
224 int count = static_key_count(key); 219 int count = static_key_count(key);
@@ -265,6 +260,17 @@ struct static_key_false {
265#define DEFINE_STATIC_KEY_FALSE(name) \ 260#define DEFINE_STATIC_KEY_FALSE(name) \
266 struct static_key_false name = STATIC_KEY_FALSE_INIT 261 struct static_key_false name = STATIC_KEY_FALSE_INIT
267 262
263extern bool ____wrong_branch_error(void);
264
265#define static_key_enabled(x) \
266({ \
267 if (!__builtin_types_compatible_p(typeof(*x), struct static_key) && \
268 !__builtin_types_compatible_p(typeof(*x), struct static_key_true) &&\
269 !__builtin_types_compatible_p(typeof(*x), struct static_key_false)) \
270 ____wrong_branch_error(); \
271 static_key_count((struct static_key *)x) > 0; \
272})
273
268#ifdef HAVE_JUMP_LABEL 274#ifdef HAVE_JUMP_LABEL
269 275
270/* 276/*
@@ -323,8 +329,6 @@ struct static_key_false {
323 * See jump_label_type() / jump_label_init_type(). 329 * See jump_label_type() / jump_label_init_type().
324 */ 330 */
325 331
326extern bool ____wrong_branch_error(void);
327
328#define static_branch_likely(x) \ 332#define static_branch_likely(x) \
329({ \ 333({ \
330 bool branch; \ 334 bool branch; \