aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/include/asm/spinlock_types.h
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2020-04-05 22:29:55 +0200
committerHelge Deller <deller@gmx.de>2020-04-05 22:29:55 +0200
commitfbdc8f0f4891df7b5eb643ec0a509a4ac7dcfc2e (patch)
tree2b9f24d527be8924201713392c8a0f235b56e032 /arch/parisc/include/asm/spinlock_types.h
parentparisc: Improve interrupt handling in arch_spin_lock_flags() (diff)
downloadlinux-dev-fbdc8f0f4891df7b5eb643ec0a509a4ac7dcfc2e.tar.xz
linux-dev-fbdc8f0f4891df7b5eb643ec0a509a4ac7dcfc2e.zip
parisc: Rework arch_rw locking functions
Clean up the arch read/write locking functions based on the arc implemenation. This improves readability of those functions. Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc/include/asm/spinlock_types.h')
-rw-r--r--arch/parisc/include/asm/spinlock_types.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/parisc/include/asm/spinlock_types.h b/arch/parisc/include/asm/spinlock_types.h
index 42979c5704dc..ca39ee350c3f 100644
--- a/arch/parisc/include/asm/spinlock_types.h
+++ b/arch/parisc/include/asm/spinlock_types.h
@@ -12,11 +12,19 @@ typedef struct {
#endif
} arch_spinlock_t;
+
+/* counter:
+ * Unlocked : 0x0100_0000
+ * Read lock(s) : 0x00FF_FFFF to 0x01 (Multiple Readers decrement it)
+ * Write lock : 0x0, but only if prior value is "unlocked" 0x0100_0000
+ */
typedef struct {
- arch_spinlock_t lock;
- volatile int counter;
+ arch_spinlock_t lock_mutex;
+ volatile unsigned int counter;
} arch_rwlock_t;
-#define __ARCH_RW_LOCK_UNLOCKED { __ARCH_SPIN_LOCK_UNLOCKED, 0 }
+#define __ARCH_RW_LOCK_UNLOCKED__ 0x01000000
+#define __ARCH_RW_LOCK_UNLOCKED { .lock_mutex = __ARCH_SPIN_LOCK_UNLOCKED, \
+ .counter = __ARCH_RW_LOCK_UNLOCKED__ }
#endif