From: Ralf Baechle Date: Thu, 3 Feb 2005 13:34:45 +0000 (+0000) Subject: Define __raw_read_can_lock / __raw_write_can_lock. X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e3c4807825501f0b445fe34b627669be24b59320;p=openwrt%2Fstaging%2Fblogic.git Define __raw_read_can_lock / __raw_write_can_lock. Signed-off-by: Ralf Baechle --- diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h index 4d0135b11156..075e9701d6bc 100644 --- a/include/asm-mips/spinlock.h +++ b/include/asm-mips/spinlock.h @@ -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;