Merge branch 'topic-0620/samsung-audio-3.4' into chromeos-exynos-3.4
[cascardo/linux.git] / drivers / gpu / vithar / osk / src / linux / include / osk / mali_osk_arch_atomics.h
1 /*
2  * This confidential and proprietary software may be used only as
3  * authorised by a licensing agreement from ARM Limited
4  * (C) COPYRIGHT 2008-2011 ARM Limited
5  * ALL RIGHTS RESERVED
6  * The entire notice above must be reproduced on all authorised
7  * copies and copies may only be made to the extent permitted
8  * by a licensing agreement from ARM Limited.
9  */
10
11 /**
12  * @file
13  * Implementation of the OS abstraction layer for the kernel device driver
14  */
15
16 #ifndef _OSK_ARCH_ATOMICS_H_
17 #define _OSK_ARCH_ATOMICS_H_
18
19 #ifndef _OSK_H_
20 #error "Include mali_osk.h directly"
21 #endif
22
23 OSK_STATIC_INLINE u32 osk_atomic_sub(osk_atomic * atom, u32 value)
24 {
25         OSK_ASSERT(NULL != atom);
26         return atomic_sub_return(value, atom);
27 }
28
29 OSK_STATIC_INLINE u32 osk_atomic_add(osk_atomic * atom, u32 value)
30 {
31         OSK_ASSERT(NULL != atom);
32         return atomic_add_return(value, atom);
33 }
34
35 OSK_STATIC_INLINE u32 osk_atomic_dec(osk_atomic * atom)
36 {
37         OSK_ASSERT(NULL != atom);
38         return osk_atomic_sub(atom, 1);
39 }
40
41 OSK_STATIC_INLINE u32 osk_atomic_inc(osk_atomic * atom)
42 {
43         OSK_ASSERT(NULL != atom);
44         return osk_atomic_add(atom, 1);
45 }
46
47 OSK_STATIC_INLINE void osk_atomic_set(osk_atomic * atom, u32 value)
48 {
49         OSK_ASSERT(NULL != atom);
50         atomic_set(atom, value);
51 }
52
53 OSK_STATIC_INLINE u32 osk_atomic_get(osk_atomic * atom)
54 {
55         OSK_ASSERT(NULL != atom);
56         return atomic_read(atom);
57 }
58
59 OSK_STATIC_INLINE u32 osk_atomic_compare_and_swap(osk_atomic * atom, u32 old_value, u32 new_value)
60 {
61         OSK_ASSERT(NULL != atom);
62         return atomic_cmpxchg(atom, old_value, new_value);
63 }
64
65 #endif /* _OSK_ARCH_ATOMICS_H_ */