[PATCH] Add missing spin_lock_irqsave_nested

From: Marcel Holtmann
Date: Fri Nov 24 2006 - 05:04:43 EST


Hi,

the latest tree has a change in net/irda/irlmp.c that uses the lockdep
annotation spin_lock_irqsave_nested. The only problem is that the
irqsave variant doesn't exists at the moment.

The attached patch is an attempt to fix this. It is only compile tested
and I hope that I did everything right. Please double-check, because I
don't touch these parts of the kernel code very often.

Regards

Marcel

[PATCH] Add missing spin_lock_irqsave_nested

This patch adds the missing spin_lock_irqsave_nested annotation which
is used by net/irda/irlmp.c now.

Signed-off-by: Marcel Holtmann <marcel@xxxxxxxxxxxx>

---
commit 45896a1478804f8849f670dd5ff9dd436a811009
tree 53b1f451f04b45c324178b06e8d386f2f3d2fb60
parent 1abbfb412b1610ec3a7ec0164108cee01191d9f5
author Marcel Holtmann <marcel@xxxxxxxxxxxx> Fri, 24 Nov 2006 11:02:41 +0100
committer Marcel Holtmann <marcel@xxxxxxxxxxxx> Fri, 24 Nov 2006 11:02:41 +0100

include/linux/spinlock.h | 2 ++
include/linux/spinlock_api_smp.h | 2 ++
include/linux/spinlock_api_up.h | 1 +
3 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index b800d2d..7f2b448 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -175,8 +175,10 @@ #define spin_lock(lock) _spin_lock(loc

#ifdef CONFIG_DEBUG_LOCK_ALLOC
# define spin_lock_nested(lock, subclass) _spin_lock_nested(lock, subclass)
+# define spin_lock_irqsave_nested(lock, flags, subclass) flags = _spin_lock_irqsave_nested(lock, flags, subclass)
#else
# define spin_lock_nested(lock, subclass) _spin_lock(lock)
+# define spin_lock_irqsave_nested(lock, flags, subclass) flags = _spin_lock_irqsave(lock)
#endif

#define write_lock(lock) _write_lock(lock)
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 8828b81..8a2307c 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -32,6 +32,8 @@ void __lockfunc _read_lock_irq(rwlock_t
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)
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h
index 67faa04..76f834d 100644
--- a/include/linux/spinlock_api_up.h
+++ b/include/linux/spinlock_api_up.h
@@ -59,6 +59,7 @@ #define _spin_lock_irq(lock) __LOCK_IR
#define _read_lock_irq(lock) __LOCK_IRQ(lock)
#define _write_lock_irq(lock) __LOCK_IRQ(lock)
#define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
+#define _spin_lock_irqsave_nested(lock, flags, subclass) __LOCK_IRQSAVE(lock, flags)
#define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
#define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
#define _spin_trylock(lock) ({ __LOCK(lock); 1; })