Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41084
b: refs/heads/master
c: cfd3ef2
h: refs/heads/master
v: v3
  • Loading branch information
Arjan van de Ven authored and Linus Torvalds committed Nov 25, 2006
1 parent 9469c7e commit 27a5bbe
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ee3ce191e8eaa4cc15c51a28b34143b36404c4f5
refs/heads/master: cfd3ef2346f924d6c0e82236c20fdb3a8840136a
18 changes: 18 additions & 0 deletions trunk/include/linux/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 { \
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/spinlock_api_smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 21 additions & 0 deletions trunk/kernel/spinlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 27a5bbe

Please sign in to comment.