dt-bindings: reset: imx7: Fix the spelling of 'indices'
[sfrench/cifs-2.6.git] / drivers / net / ethernet / aquantia / atlantic / aq_utils.h
1 /*
2  * aQuantia Corporation Network Driver
3  * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  */
9
10 /* File aq_utils.h: Useful macro and structures used in all layers of driver. */
11
12 #ifndef AQ_UTILS_H
13 #define AQ_UTILS_H
14
15 #include "aq_common.h"
16
17 static inline void aq_utils_obj_set(atomic_t *flags, u32 mask)
18 {
19         unsigned long flags_old, flags_new;
20
21         do {
22                 flags_old = atomic_read(flags);
23                 flags_new = flags_old | (mask);
24         } while (atomic_cmpxchg(flags, flags_old, flags_new) != flags_old);
25 }
26
27 static inline void aq_utils_obj_clear(atomic_t *flags, u32 mask)
28 {
29         unsigned long flags_old, flags_new;
30
31         do {
32                 flags_old = atomic_read(flags);
33                 flags_new = flags_old & ~(mask);
34         } while (atomic_cmpxchg(flags, flags_old, flags_new) != flags_old);
35 }
36
37 static inline bool aq_utils_obj_test(atomic_t *flags, u32 mask)
38 {
39         return atomic_read(flags) & mask;
40 }
41
42 #endif /* AQ_UTILS_H */