This source file includes following definitions.
- aq_utils_obj_set
- aq_utils_obj_clear
- aq_utils_obj_test
1
2
3
4
5
6
7
8
9 #ifndef AQ_UTILS_H
10 #define AQ_UTILS_H
11
12 #include "aq_common.h"
13
14 static inline void aq_utils_obj_set(atomic_t *flags, u32 mask)
15 {
16 unsigned long flags_old, flags_new;
17
18 do {
19 flags_old = atomic_read(flags);
20 flags_new = flags_old | (mask);
21 } while (atomic_cmpxchg(flags, flags_old, flags_new) != flags_old);
22 }
23
24 static inline void aq_utils_obj_clear(atomic_t *flags, u32 mask)
25 {
26 unsigned long flags_old, flags_new;
27
28 do {
29 flags_old = atomic_read(flags);
30 flags_new = flags_old & ~(mask);
31 } while (atomic_cmpxchg(flags, flags_old, flags_new) != flags_old);
32 }
33
34 static inline bool aq_utils_obj_test(atomic_t *flags, u32 mask)
35 {
36 return atomic_read(flags) & mask;
37 }
38
39 #endif