Define __raw_read_can_lock / __raw_write_can_lock.
authorRalf Baechle <ralf@linux-mips.org>
Thu, 3 Feb 2005 13:34:45 +0000 (13:34 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Sat, 29 Oct 2005 18:30:22 +0000 (19:30 +0100)
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
include/asm-mips/spinlock.h

index 4d0135b111567e5e59956a3bd30bf7b58f86debe..075e9701d6bc2de571a028592bb943968d1563d3 100644 (file)
@@ -119,6 +119,18 @@ static inline unsigned int __raw_spin_trylock(raw_spinlock_t *lock)
  * read-locks.
  */
 
+/*
+ * read_can_lock - would read_trylock() succeed?
+ * @lock: the rwlock in question.
+ */
+#define __raw_read_can_lock(rw)        ((rw)->lock >= 0)
+
+/*
+ * write_can_lock - would write_trylock() succeed?
+ * @lock: the rwlock in question.
+ */
+#define __raw_write_can_lock(rw)       (!(rw)->lock)
+
 static inline void __raw_read_lock(raw_rwlock_t *rw)
 {
        unsigned int tmp;