qrwlock_types.h 682 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_GENERIC_QRWLOCK_TYPES_H
  3. #define __ASM_GENERIC_QRWLOCK_TYPES_H
  4. #include <linux/types.h>
  5. #include <asm/byteorder.h>
  6. #include <asm/spinlock_types.h>
  7. /*
  8. * The queue read/write lock data structure
  9. */
  10. typedef struct qrwlock {
  11. union {
  12. atomic_t cnts;
  13. struct {
  14. #ifdef __LITTLE_ENDIAN
  15. u8 wlocked; /* Locked for write? */
  16. u8 __lstate[3];
  17. #else
  18. u8 __lstate[3];
  19. u8 wlocked; /* Locked for write? */
  20. #endif
  21. };
  22. };
  23. arch_spinlock_t wait_lock;
  24. } arch_rwlock_t;
  25. #define __ARCH_RW_LOCK_UNLOCKED { \
  26. { .cnts = ATOMIC_INIT(0), }, \
  27. .wait_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
  28. }
  29. #endif /* __ASM_GENERIC_QRWLOCK_TYPES_H */