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 <kris.van.hees@oracle.com>
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 */