Loading...
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
11typedef struct qrwlock {
12 atomic_t cnts;
13 arch_spinlock_t wait_lock;
14} arch_rwlock_t;
15
16#define __ARCH_RW_LOCK_UNLOCKED { \
17 .cnts = ATOMIC_INIT(0), \
18 .wait_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
19}
20
21#endif /* __ASM_GENERIC_QRWLOCK_TYPES_H */
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 queue read/write lock data structure
11 */
12
13typedef 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 */