Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_GENERIC_QRWLOCK_TYPES_H
0003 #define __ASM_GENERIC_QRWLOCK_TYPES_H
0004 
0005 #include <linux/types.h>
0006 #include <asm/byteorder.h>
0007 #include <asm/spinlock_types.h>
0008 
0009 /*
0010  * The queued read/write lock data structure
0011  */
0012 
0013 typedef struct qrwlock {
0014     union {
0015         atomic_t cnts;
0016         struct {
0017 #ifdef __LITTLE_ENDIAN
0018             u8 wlocked; /* Locked for write? */
0019             u8 __lstate[3];
0020 #else
0021             u8 __lstate[3];
0022             u8 wlocked; /* Locked for write? */
0023 #endif
0024         };
0025     };
0026     arch_spinlock_t     wait_lock;
0027 } arch_rwlock_t;
0028 
0029 #define __ARCH_RW_LOCK_UNLOCKED {       \
0030     { .cnts = ATOMIC_INIT(0), },        \
0031     .wait_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
0032 }
0033 
0034 #endif /* __ASM_GENERIC_QRWLOCK_TYPES_H */