1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 270af2f8aSWaiman Long #ifndef __ASM_GENERIC_QRWLOCK_TYPES_H 370af2f8aSWaiman Long #define __ASM_GENERIC_QRWLOCK_TYPES_H 470af2f8aSWaiman Long 570af2f8aSWaiman Long #include <linux/types.h> 6ca66e797SArnd Bergmann #include <asm/byteorder.h> 770af2f8aSWaiman Long #include <asm/spinlock_types.h> 870af2f8aSWaiman Long 970af2f8aSWaiman Long /* 10*434e09e7SWaiman Long * The queued read/write lock data structure 1170af2f8aSWaiman Long */ 1270af2f8aSWaiman Long 1370af2f8aSWaiman Long typedef struct qrwlock { 14e0d02285SWill Deacon union { 1570af2f8aSWaiman Long atomic_t cnts; 16e0d02285SWill Deacon struct { 17e0d02285SWill Deacon #ifdef __LITTLE_ENDIAN 18d1331661SWill Deacon u8 wlocked; /* Locked for write? */ 19d1331661SWill Deacon u8 __lstate[3]; 20e0d02285SWill Deacon #else 21d1331661SWill Deacon u8 __lstate[3]; 22d1331661SWill Deacon u8 wlocked; /* Locked for write? */ 23e0d02285SWill Deacon #endif 24e0d02285SWill Deacon }; 25e0d02285SWill Deacon }; 266e1e5196SDavidlohr Bueso arch_spinlock_t wait_lock; 2770af2f8aSWaiman Long } arch_rwlock_t; 2870af2f8aSWaiman Long 2970af2f8aSWaiman Long #define __ARCH_RW_LOCK_UNLOCKED { \ 30e0d02285SWill Deacon { .cnts = ATOMIC_INIT(0), }, \ 316e1e5196SDavidlohr Bueso .wait_lock = __ARCH_SPIN_LOCK_UNLOCKED, \ 3270af2f8aSWaiman Long } 3370af2f8aSWaiman Long 3470af2f8aSWaiman Long #endif /* __ASM_GENERIC_QRWLOCK_TYPES_H */ 35