aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/lockref.h
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-11-24 09:35:18 -0500
committerMark Brown <broonie@linaro.org>2013-11-24 09:35:18 -0500
commit30c27abd28fa168d7ebd2e5286f1fe473c74bfa9 (patch)
tree9936b38c0c81cd430d5e75906c1207d127fe588c /include/linux/lockref.h
parent16ec790938d4f356c82fab27b9a9adf4d6fe19a6 (diff)
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff)
Merge tag 'v3.13-rc1' into asoc-arizona
Linux 3.13-rc1
Diffstat (limited to 'include/linux/lockref.h')
-rw-r--r--include/linux/lockref.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/linux/lockref.h b/include/linux/lockref.h
index f279ed9a9163..c8929c3832db 100644
--- a/include/linux/lockref.h
+++ b/include/linux/lockref.h
@@ -15,10 +15,15 @@
15 */ 15 */
16 16
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <generated/bounds.h>
19
20#define USE_CMPXCHG_LOCKREF \
21 (IS_ENABLED(CONFIG_ARCH_USE_CMPXCHG_LOCKREF) && \
22 IS_ENABLED(CONFIG_SMP) && !BLOATED_SPINLOCKS)
18 23
19struct lockref { 24struct lockref {
20 union { 25 union {
21#ifdef CONFIG_CMPXCHG_LOCKREF 26#if USE_CMPXCHG_LOCKREF
22 aligned_u64 lock_count; 27 aligned_u64 lock_count;
23#endif 28#endif
24 struct { 29 struct {
@@ -36,4 +41,10 @@ extern int lockref_put_or_lock(struct lockref *);
36extern void lockref_mark_dead(struct lockref *); 41extern void lockref_mark_dead(struct lockref *);
37extern int lockref_get_not_dead(struct lockref *); 42extern int lockref_get_not_dead(struct lockref *);
38 43
44/* Must be called under spinlock for reliable results */
45static inline int __lockref_is_dead(const struct lockref *l)
46{
47 return ((int)l->count < 0);
48}
49
39#endif /* __LINUX_LOCKREF_H */ 50#endif /* __LINUX_LOCKREF_H */