From 366c0450cd228f1ad2a4a19f548782d2d5803aa3 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 25 Apr 2012 11:03:53 +1000 Subject: [PATCH] include/linux/spinlock.h: add a kerneldoc comment to spin_is_locked() that discourages its use Signed-off-by: Andi Kleen Cc: Wolfram Sang Signed-off-by: Andrew Morton --- include/linux/spinlock.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 7d537ced949a..d7a040904323 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); -- 2.39.5