]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] lockdep: spin_lock_irqsave_nested()
authorArjan van de Ven <arjan@linux.intel.com>
Sat, 25 Nov 2006 19:09:37 +0000 (11:09 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Sat, 25 Nov 2006 21:28:34 +0000 (13:28 -0800)
Introduce spin_lock_irqsave_nested(); implementation from:
 http://lkml.org/lkml/2006/6/1/122
Patch from:
 http://lkml.org/lkml/2006/9/13/258

[akpm@osdl.org: two compile fixes]
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Jiri Kosina <jikos@jikos.cz>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/spinlock.h
include/linux/spinlock_api_smp.h
kernel/spinlock.c

index 54ad37089c499c96bba78add0a63972fbff495b9..57f670d78f7c6af9db9716fdf12709dbeef4bf86 100644 (file)
@@ -199,6 +199,21 @@ do {                                                               \
                BUILD_CHECK_IRQ_FLAGS(flags);           \
                flags = _write_lock_irqsave(lock);      \
        } while (0)
+
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#define spin_lock_irqsave_nested(lock, flags, subclass)                        \
+       do {                                                            \
+               BUILD_CHECK_IRQ_FLAGS(flags);                           \
+               flags = _spin_lock_irqsave_nested(lock, subclass);      \
+       } while (0)
+#else
+#define spin_lock_irqsave_nested(lock, flags, subclass)                        \
+       do {                                                            \
+               BUILD_CHECK_IRQ_FLAGS(flags);                           \
+               flags = _spin_lock_irqsave(lock);                       \
+       } while (0)
+#endif
+
 #else
 #define spin_lock_irqsave(lock, flags)                 \
        do {                                            \
@@ -215,6 +230,9 @@ do {                                                                \
                BUILD_CHECK_IRQ_FLAGS(flags);           \
                _write_lock_irqsave(lock, flags);       \
        } while (0)
+#define spin_lock_irqsave_nested(lock, flags, subclass)        \
+       spin_lock_irqsave(lock, flags)
+
 #endif
 
 #define spin_lock_irq(lock)            _spin_lock_irq(lock)
index 8828b8155e9c11db7abb99c8342b7ee66d8e6839..8a2307ce729687f25a954969ae14df0b31748915 100644 (file)
@@ -32,6 +32,8 @@ void __lockfunc _read_lock_irq(rwlock_t *lock)                __acquires(lock);
 void __lockfunc _write_lock_irq(rwlock_t *lock)                __acquires(lock);
 unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
                                                        __acquires(lock);
+unsigned long __lockfunc _spin_lock_irqsave_nested(spinlock_t *lock, int subclass)
+                                                       __acquires(lock);
 unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
                                                        __acquires(lock);
 unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
index 476c3741511b31af1717f90e052880e0e6c9b585..2c6c2bf8551446873520376373d78273d16d4f58 100644 (file)
@@ -293,6 +293,27 @@ void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass)
 }
 
 EXPORT_SYMBOL(_spin_lock_nested);
+unsigned long __lockfunc _spin_lock_irqsave_nested(spinlock_t *lock, int subclass)
+{
+       unsigned long flags;
+
+       local_irq_save(flags);
+       preempt_disable();
+       spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_);
+       /*
+        * On lockdep we dont want the hand-coded irq-enable of
+        * _raw_spin_lock_flags() code, because lockdep assumes
+        * that interrupts are not re-enabled during lock-acquire:
+        */
+#ifdef CONFIG_PROVE_SPIN_LOCKING
+       _raw_spin_lock(lock);
+#else
+       _raw_spin_lock_flags(lock, &flags);
+#endif
+       return flags;
+}
+
+EXPORT_SYMBOL(_spin_lock_irqsave_nested);
 
 #endif