~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to include/linux/jump_label_ref.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef _LINUX_JUMP_LABEL_REF_H
2
 
#define _LINUX_JUMP_LABEL_REF_H
3
 
 
4
 
#include <linux/jump_label.h>
5
 
#include <asm/atomic.h>
6
 
 
7
 
#ifdef HAVE_JUMP_LABEL
8
 
 
9
 
static inline void jump_label_inc(atomic_t *key)
10
 
{
11
 
        if (atomic_add_return(1, key) == 1)
12
 
                jump_label_enable(key);
13
 
}
14
 
 
15
 
static inline void jump_label_dec(atomic_t *key)
16
 
{
17
 
        if (atomic_dec_and_test(key))
18
 
                jump_label_disable(key);
19
 
}
20
 
 
21
 
#else /* !HAVE_JUMP_LABEL */
22
 
 
23
 
static inline void jump_label_inc(atomic_t *key)
24
 
{
25
 
        atomic_inc(key);
26
 
}
27
 
 
28
 
static inline void jump_label_dec(atomic_t *key)
29
 
{
30
 
        atomic_dec(key);
31
 
}
32
 
 
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)
41
 
 
42
 
#endif /* HAVE_JUMP_LABEL */
43
 
 
44
 
#endif /* _LINUX_JUMP_LABEL_REF_H */