blob: 8af752acbdc0849c5fe1bb74a82f4993a736a0b6 [file] [log] [blame]
Waiman Long70af2f82014-02-03 13:18:49 +01001#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
11typedef struct qrwlock {
Will Deacon22a84c52017-10-12 13:20:47 +010012 union {
13 atomic_t cnts;
14 struct {
15#ifdef __LITTLE_ENDIAN
Will Deacon748ac622017-10-12 13:20:51 +010016 u8 wlocked; /* Locked for write? */
17 u8 __lstate[3];
Will Deacon22a84c52017-10-12 13:20:47 +010018#else
Will Deacon748ac622017-10-12 13:20:51 +010019 u8 __lstate[3];
20 u8 wlocked; /* Locked for write? */
Will Deacon22a84c52017-10-12 13:20:47 +010021#endif
22 };
23 };
Davidlohr Bueso6e1e5192015-09-14 00:37:22 -070024 arch_spinlock_t wait_lock;
Waiman Long70af2f82014-02-03 13:18:49 +010025} arch_rwlock_t;
26
27#define __ARCH_RW_LOCK_UNLOCKED { \
Will Deacon22a84c52017-10-12 13:20:47 +010028 { .cnts = ATOMIC_INIT(0), }, \
Davidlohr Bueso6e1e5192015-09-14 00:37:22 -070029 .wait_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
Waiman Long70af2f82014-02-03 13:18:49 +010030}
31
32#endif /* __ASM_GENERIC_QRWLOCK_TYPES_H */