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

Go to the source code of this file.

Macros

#define ATOMIC_INIT(i)   { (i) }
 
#define atomic_xchg(v, new)   (xchg(&((v)->counter), new))
 
#define atomic_read(v)   (*(volatile int *)&(v)->counter)
 
#define atomic_add(i, v)   ((void)__atomic_add_return( (int)(i), (v)))
 
#define atomic_sub(i, v)   ((void)__atomic_add_return(-(int)(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( (int)(i), (v)))
 
#define atomic_sub_return(i, v)   (__atomic_add_return(-(int)(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 smp_mb__before_atomic_dec()   barrier()
 
#define smp_mb__after_atomic_dec()   barrier()
 
#define smp_mb__before_atomic_inc()   barrier()
 
#define smp_mb__after_atomic_inc()   barrier()
 

Functions

int __atomic_add_return (int, atomic_t *)
 
int atomic_cmpxchg (atomic_t *, int, int)
 
int __atomic_add_unless (atomic_t *, int, int)
 
void atomic_set (atomic_t *, int)
 

Macro Definition Documentation

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

Definition at line 30 of file atomic_32.h.

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

Definition at line 40 of file atomic_32.h.

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

Definition at line 35 of file atomic_32.h.

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

Definition at line 33 of file atomic_32.h.

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

Definition at line 52 of file atomic_32.h.

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

Definition at line 38 of file atomic_32.h.

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

Definition at line 32 of file atomic_32.h.

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

Definition at line 50 of file atomic_32.h.

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

Definition at line 37 of file atomic_32.h.

#define ATOMIC_INIT (   i)    { (i) }

Definition at line 20 of file atomic_32.h.

#define atomic_read (   v)    (*(volatile int *)&(v)->counter)

Definition at line 28 of file atomic_32.h.

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

Definition at line 31 of file atomic_32.h.

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

Definition at line 53 of file atomic_32.h.

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

Definition at line 36 of file atomic_32.h.

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

Definition at line 24 of file atomic_32.h.

#define smp_mb__after_atomic_dec ( )    barrier()

Definition at line 57 of file atomic_32.h.

#define smp_mb__after_atomic_inc ( )    barrier()

Definition at line 59 of file atomic_32.h.

#define smp_mb__before_atomic_dec ( )    barrier()

Definition at line 56 of file atomic_32.h.

#define smp_mb__before_atomic_inc ( )    barrier()

Definition at line 58 of file atomic_32.h.

Function Documentation

int __atomic_add_return ( int  ,
atomic_t  
)

Definition at line 30 of file atomic32.c.

int __atomic_add_unless ( atomic_t ,
int  ,
int   
)

Definition at line 58 of file atomic32.c.

int atomic_cmpxchg ( atomic_t ,
int  ,
int   
)

Definition at line 43 of file atomic32.c.

void atomic_set ( atomic_t ,
int   
)

Definition at line 73 of file atomic32.c.