Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros
atomic.h File Reference
#include <linux/types.h>
#include <asm/cmpxchg.h>

Go to the source code of this file.

Macros

#define _atomic_spin_lock_irqsave(l, f)   do { local_irq_save(f); } while (0)
 
#define _atomic_spin_unlock_irqrestore(l, f)   do { local_irq_restore(f); } while (0)
 
#define atomic_cmpxchg(v, o, n)   (cmpxchg(&((v)->counter), (o), (n)))
 
#define atomic_xchg(v, new)   (xchg(&((v)->counter), new))
 
#define atomic_add(i, v)   ((void)(__atomic_add_return( (i),(v))))
 
#define atomic_sub(i, v)   ((void)(__atomic_add_return(-(i),(v))))
 
#define atomic_inc(v)   ((void)(__atomic_add_return( 1,(v))))
 
#define atomic_dec(v)   ((void)(__atomic_add_return( -1,(v))))
 
#define atomic_add_return(i, v)   (__atomic_add_return( (i),(v)))
 
#define atomic_sub_return(i, v)   (__atomic_add_return(-(i),(v)))
 
#define atomic_inc_return(v)   (__atomic_add_return( 1,(v)))
 
#define atomic_dec_return(v)   (__atomic_add_return( -1,(v)))
 
#define atomic_add_negative(a, v)   (atomic_add_return((a), (v)) < 0)
 
#define atomic_inc_and_test(v)   (atomic_inc_return(v) == 0)
 
#define atomic_dec_and_test(v)   (atomic_dec_return(v) == 0)
 
#define atomic_sub_and_test(i, v)   (atomic_sub_return((i),(v)) == 0)
 
#define ATOMIC_INIT(i)   { (i) }
 
#define smp_mb__before_atomic_dec()   smp_mb()
 
#define smp_mb__after_atomic_dec()   smp_mb()
 
#define smp_mb__before_atomic_inc()   smp_mb()
 
#define smp_mb__after_atomic_inc()   smp_mb()
 

Macro Definition Documentation

#define _atomic_spin_lock_irqsave (   l,
  f 
)    do { local_irq_save(f); } while (0)

Definition at line 48 of file atomic.h.

#define _atomic_spin_unlock_irqrestore (   l,
  f 
)    do { local_irq_restore(f); } while (0)

Definition at line 49 of file atomic.h.

#define atomic_add (   i,
  v 
)    ((void)(__atomic_add_return( (i),(v))))

Definition at line 118 of file atomic.h.

#define atomic_add_negative (   a,
  v 
)    (atomic_add_return((a), (v)) < 0)

Definition at line 128 of file atomic.h.

#define atomic_add_return (   i,
  v 
)    (__atomic_add_return( (i),(v)))

Definition at line 123 of file atomic.h.

#define atomic_cmpxchg (   v,
  o,
  n 
)    (cmpxchg(&((v)->counter), (o), (n)))

Definition at line 90 of file atomic.h.

#define atomic_dec (   v)    ((void)(__atomic_add_return( -1,(v))))

Definition at line 121 of file atomic.h.

#define atomic_dec_and_test (   v)    (atomic_dec_return(v) == 0)

Definition at line 140 of file atomic.h.

#define atomic_dec_return (   v)    (__atomic_add_return( -1,(v)))

Definition at line 126 of file atomic.h.

#define atomic_inc (   v)    ((void)(__atomic_add_return( 1,(v))))

Definition at line 120 of file atomic.h.

#define atomic_inc_and_test (   v)    (atomic_inc_return(v) == 0)

Definition at line 138 of file atomic.h.

#define atomic_inc_return (   v)    (__atomic_add_return( 1,(v)))

Definition at line 125 of file atomic.h.

#define ATOMIC_INIT (   i)    { (i) }

Definition at line 144 of file atomic.h.

#define atomic_sub (   i,
  v 
)    ((void)(__atomic_add_return(-(i),(v))))

Definition at line 119 of file atomic.h.

#define atomic_sub_and_test (   i,
  v 
)    (atomic_sub_return((i),(v)) == 0)

Definition at line 142 of file atomic.h.

#define atomic_sub_return (   i,
  v 
)    (__atomic_add_return(-(i),(v)))

Definition at line 124 of file atomic.h.

#define atomic_xchg (   v,
  new 
)    (xchg(&((v)->counter), new))

Definition at line 91 of file atomic.h.

#define smp_mb__after_atomic_dec ( )    smp_mb()

Definition at line 147 of file atomic.h.

#define smp_mb__after_atomic_inc ( )    smp_mb()

Definition at line 149 of file atomic.h.

#define smp_mb__before_atomic_dec ( )    smp_mb()

Definition at line 146 of file atomic.h.

#define smp_mb__before_atomic_inc ( )    smp_mb()

Definition at line 148 of file atomic.h.