HID: add hid_hw_open/close/power() handlers
[linux-2.6/kvm.git] / include / linux / jump_label.h
blobb67cb180e6e943ffef4f70577c0a8f503b496cee
1 #ifndef _LINUX_JUMP_LABEL_H
2 #define _LINUX_JUMP_LABEL_H
4 #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_HAVE_ARCH_JUMP_LABEL)
5 # include <asm/jump_label.h>
6 # define HAVE_JUMP_LABEL
7 #endif
9 enum jump_label_type {
10 JUMP_LABEL_ENABLE,
11 JUMP_LABEL_DISABLE
14 struct module;
16 #ifdef HAVE_JUMP_LABEL
18 extern struct jump_entry __start___jump_table[];
19 extern struct jump_entry __stop___jump_table[];
21 extern void arch_jump_label_transform(struct jump_entry *entry,
22 enum jump_label_type type);
23 extern void arch_jump_label_text_poke_early(jump_label_t addr);
24 extern void jump_label_update(unsigned long key, enum jump_label_type type);
25 extern void jump_label_apply_nops(struct module *mod);
26 extern int jump_label_text_reserved(void *start, void *end);
28 #define jump_label_enable(key) \
29 jump_label_update((unsigned long)key, JUMP_LABEL_ENABLE);
31 #define jump_label_disable(key) \
32 jump_label_update((unsigned long)key, JUMP_LABEL_DISABLE);
34 #else
36 #define JUMP_LABEL(key, label) \
37 do { \
38 if (unlikely(*key)) \
39 goto label; \
40 } while (0)
42 #define jump_label_enable(cond_var) \
43 do { \
44 *(cond_var) = 1; \
45 } while (0)
47 #define jump_label_disable(cond_var) \
48 do { \
49 *(cond_var) = 0; \
50 } while (0)
52 static inline int jump_label_apply_nops(struct module *mod)
54 return 0;
57 static inline int jump_label_text_reserved(void *start, void *end)
59 return 0;
62 #endif
64 #define COND_STMT(key, stmt) \
65 do { \
66 __label__ jl_enabled; \
67 JUMP_LABEL(key, jl_enabled); \
68 if (0) { \
69 jl_enabled: \
70 stmt; \
71 } \
72 } while (0)
74 #endif