Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
70af2f8a WL |
2 | #ifndef __ASM_GENERIC_QRWLOCK_TYPES_H |
3 | #define __ASM_GENERIC_QRWLOCK_TYPES_H | |
4 | ||
5 | #include <linux/types.h> | |
ca66e797 | 6 | #include <asm/byteorder.h> |
70af2f8a WL |
7 | #include <asm/spinlock_types.h> |
8 | ||
9 | /* | |
434e09e7 | 10 | * The queued read/write lock data structure |
70af2f8a WL |
11 | */ |
12 | ||
13 | typedef struct qrwlock { | |
e0d02285 WD |
14 | union { |
15 | atomic_t cnts; | |
16 | struct { | |
17 | #ifdef __LITTLE_ENDIAN | |
d1331661 WD |
18 | u8 wlocked; /* Locked for write? */ |
19 | u8 __lstate[3]; | |
e0d02285 | 20 | #else |
d1331661 WD |
21 | u8 __lstate[3]; |
22 | u8 wlocked; /* Locked for write? */ | |
e0d02285 WD |
23 | #endif |
24 | }; | |
25 | }; | |
6e1e5196 | 26 | arch_spinlock_t wait_lock; |
70af2f8a WL |
27 | } arch_rwlock_t; |
28 | ||
29 | #define __ARCH_RW_LOCK_UNLOCKED { \ | |
e0d02285 | 30 | { .cnts = ATOMIC_INIT(0), }, \ |
6e1e5196 | 31 | .wait_lock = __ARCH_SPIN_LOCK_UNLOCKED, \ |
70af2f8a WL |
32 | } |
33 | ||
34 | #endif /* __ASM_GENERIC_QRWLOCK_TYPES_H */ |