]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/asm-generic/qspinlock_types.h
dmaengine: Fix access to uninitialized dma_slave_caps
[mirror_ubuntu-bionic-kernel.git] / include / asm-generic / qspinlock_types.h
index 034acd0c4956b59932f650e85612a9397236dc66..d10f1e7d6ba8c37140ae9332b59399baae4ffdf1 100644 (file)
 #endif
 
 typedef struct qspinlock {
-       atomic_t        val;
+       union {
+               atomic_t val;
+
+               /*
+                * By using the whole 2nd least significant byte for the
+                * pending bit, we can allow better optimization of the lock
+                * acquisition for the pending bit holder.
+                */
+#ifdef __LITTLE_ENDIAN
+               struct {
+                       u8      locked;
+                       u8      pending;
+               };
+               struct {
+                       u16     locked_pending;
+                       u16     tail;
+               };
+#else
+               struct {
+                       u16     tail;
+                       u16     locked_pending;
+               };
+               struct {
+                       u8      reserved[2];
+                       u8      pending;
+                       u8      locked;
+               };
+#endif
+       };
 } arch_spinlock_t;
 
 /*
  * Initializier
  */
-#define        __ARCH_SPIN_LOCK_UNLOCKED       { ATOMIC_INIT(0) }
+#define        __ARCH_SPIN_LOCK_UNLOCKED       { { .val = ATOMIC_INIT(0) } }
 
 /*
  * Bitfields in the atomic value: