Staging: hv: Use generic device_driver probe function
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / jump_label_ref.h
blobe5d012ad92c641092219b35a8e38f1f224a33dde
1 #ifndef _LINUX_JUMP_LABEL_REF_H
2 #define _LINUX_JUMP_LABEL_REF_H
4 #include <linux/jump_label.h>
5 #include <asm/atomic.h>
7 #ifdef HAVE_JUMP_LABEL
9 static inline void jump_label_inc(atomic_t *key)
11 if (atomic_add_return(1, key) == 1)
12 jump_label_enable(key);
15 static inline void jump_label_dec(atomic_t *key)
17 if (atomic_dec_and_test(key))
18 jump_label_disable(key);
21 #else /* !HAVE_JUMP_LABEL */
23 static inline void jump_label_inc(atomic_t *key)
25 atomic_inc(key);
28 static inline void jump_label_dec(atomic_t *key)
30 atomic_dec(key);
33 #undef JUMP_LABEL
34 #define JUMP_LABEL(key, label) \
35 do { \
36 if (unlikely(__builtin_choose_expr( \
37 __builtin_types_compatible_p(typeof(key), atomic_t *), \
38 atomic_read((atomic_t *)(key)), *(key)))) \
39 goto label; \
40 } while (0)
42 #endif /* HAVE_JUMP_LABEL */
44 #endif /* _LINUX_JUMP_LABEL_REF_H */