From: Kris Van Hees Date: Tue, 7 Feb 2012 09:31:48 +0000 (-0500) Subject: dtrace: use new mutex_owned(), not mutex_is_locked() X-Git-Tag: v4.1.12-92~313^2~152 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=251c236cf5cc7c48cbacb283b6078d4024f3edae;p=users%2Fjedix%2Flinux-maple.git dtrace: use new mutex_owned(), not mutex_is_locked() This is used in our implementation of the Solaris MUTEX_HELD() macro. The former was merely testing whether the mutex was locked, whereas the real test needed here is whether the mutex is held by the current thread. Signed-off-by: Kris Van Hees --- diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 2cb7531e7d7a..0df7f84bc282 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -175,4 +175,16 @@ extern void mutex_unlock(struct mutex *lock); extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); +#ifdef CONFIG_SMP +static inline int mutex_owned(struct mutex *lock) +{ + return lock->owner == current; +} +#else +static inline int mutex_owned(struct mutex *lock) +{ + return mutex_is_locked(lock); +} +#endif + #endif /* __LINUX_MUTEX_H */