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