summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/spinlock_rt.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/spinlock_rt.h b/include/linux/spinlock_rt.h
index 205ca95a849e..3b555b4b52cf 100644
--- a/include/linux/spinlock_rt.h
+++ b/include/linux/spinlock_rt.h
@@ -51,7 +51,17 @@ extern void __lockfunc __rt_spin_unlock(struct rt_mutex *lock);
#define spin_lock_irq(lock) spin_lock(lock)
-#define spin_trylock(lock) __cond_lock(lock, rt_spin_trylock(lock))
+#define spin_do_trylock(lock) __cond_lock(lock, rt_spin_trylock(lock))
+
+#define spin_trylock(lock) \
+({ \
+ int __locked; \
+ migrate_disable(); \
+ __locked = spin_do_trylock(lock); \
+ if (!__locked) \
+ migrate_enable(); \
+ __locked; \
+})
#ifdef CONFIG_LOCKDEP
# define spin_lock_nested(lock, subclass) \