Messages in this thread Patch in this message | | | From | Andi Kleen <> | Subject | [PATCH 12/13] Add a kerneldoc comment to spin_is_locked() that discourages its usage | Date | Tue, 27 Mar 2012 17:47:16 -0700 |
| |
From: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com> --- include/linux/spinlock.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 7df6c17..4805e4d 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -360,6 +360,15 @@ static inline void spin_unlock_wait(spinlock_t *lock) raw_spin_unlock_wait(&lock->rlock); } +/** + * spin_is_locked() - Check if a spinlock is being held. + * @lock: Lock to check. + * + * This function should normally not be used. Especially using it in + * WARN and BUG_ONs is usually incorrect or redundant. + * If you want to check if a lock is held in a function + * use lockdep_assert_held(). A lot of other usages are racy. + */ static inline int spin_is_locked(spinlock_t *lock) { return raw_spin_is_locked(&lock->rlock); -- 1.7.7.6
| |