Waiman Long | 70af2f8 | 2014-02-03 13:18:49 +0100 | [diff] [blame] | 1 | #ifndef __ASM_GENERIC_QRWLOCK_TYPES_H |
| 2 | #define __ASM_GENERIC_QRWLOCK_TYPES_H |
| 3 | |
| 4 | #include <linux/types.h> |
| 5 | #include <asm/spinlock_types.h> |
| 6 | |
| 7 | /* |
| 8 | * The queue read/write lock data structure |
| 9 | */ |
| 10 | |
| 11 | typedef struct qrwlock { |
Will Deacon | 22a84c5 | 2017-10-12 13:20:47 +0100 | [diff] [blame] | 12 | union { |
| 13 | atomic_t cnts; |
| 14 | struct { |
| 15 | #ifdef __LITTLE_ENDIAN |
Will Deacon | 748ac62 | 2017-10-12 13:20:51 +0100 | [diff] [blame] | 16 | u8 wlocked; /* Locked for write? */ |
| 17 | u8 __lstate[3]; |
Will Deacon | 22a84c5 | 2017-10-12 13:20:47 +0100 | [diff] [blame] | 18 | #else |
Will Deacon | 748ac62 | 2017-10-12 13:20:51 +0100 | [diff] [blame] | 19 | u8 __lstate[3]; |
| 20 | u8 wlocked; /* Locked for write? */ |
Will Deacon | 22a84c5 | 2017-10-12 13:20:47 +0100 | [diff] [blame] | 21 | #endif |
| 22 | }; |
| 23 | }; |
Davidlohr Bueso | 6e1e519 | 2015-09-14 00:37:22 -0700 | [diff] [blame] | 24 | arch_spinlock_t wait_lock; |
Waiman Long | 70af2f8 | 2014-02-03 13:18:49 +0100 | [diff] [blame] | 25 | } arch_rwlock_t; |
| 26 | |
| 27 | #define __ARCH_RW_LOCK_UNLOCKED { \ |
Will Deacon | 22a84c5 | 2017-10-12 13:20:47 +0100 | [diff] [blame] | 28 | { .cnts = ATOMIC_INIT(0), }, \ |
Davidlohr Bueso | 6e1e519 | 2015-09-14 00:37:22 -0700 | [diff] [blame] | 29 | .wait_lock = __ARCH_SPIN_LOCK_UNLOCKED, \ |
Waiman Long | 70af2f8 | 2014-02-03 13:18:49 +0100 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | #endif /* __ASM_GENERIC_QRWLOCK_TYPES_H */ |