locking: Move spinlock function bodies to header file
Move spinlock function bodies to header file by creating a static inline version of each variant. Use the inline version on the out-of-line code. This shouldn't make any difference besides that the spinlock code can now be used to generate inlined spinlock code. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Horst Hartmann <horsth@linux.vnet.ibm.com> Cc: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: David Miller <davem@davemloft.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: <linux-arch@vger.kernel.org> LKML-Reference: <20090831124417.859022429@de.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
0ee000e5e8
commit
69d0ee7377
|
@ -143,15 +143,6 @@ static inline void smp_mb__after_lock(void) { smp_mb(); }
|
||||||
*/
|
*/
|
||||||
#define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock)
|
#define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock)
|
||||||
|
|
||||||
/*
|
|
||||||
* Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
|
|
||||||
*/
|
|
||||||
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
|
|
||||||
# include <linux/spinlock_api_smp.h>
|
|
||||||
#else
|
|
||||||
# include <linux/spinlock_api_up.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_SPINLOCK
|
#ifdef CONFIG_DEBUG_SPINLOCK
|
||||||
extern void _raw_spin_lock(spinlock_t *lock);
|
extern void _raw_spin_lock(spinlock_t *lock);
|
||||||
#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
|
#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
|
||||||
|
@ -380,4 +371,13 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
|
||||||
*/
|
*/
|
||||||
#define spin_can_lock(lock) (!spin_is_locked(lock))
|
#define spin_can_lock(lock) (!spin_is_locked(lock))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
|
||||||
|
*/
|
||||||
|
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
|
||||||
|
# include <linux/spinlock_api_smp.h>
|
||||||
|
#else
|
||||||
|
# include <linux/spinlock_api_up.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __LINUX_SPINLOCK_H */
|
#endif /* __LINUX_SPINLOCK_H */
|
||||||
|
|
|
@ -60,4 +60,267 @@ void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
|
||||||
void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
|
void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
|
||||||
__releases(lock);
|
__releases(lock);
|
||||||
|
|
||||||
|
static inline int __spin_trylock(spinlock_t *lock)
|
||||||
|
{
|
||||||
|
preempt_disable();
|
||||||
|
if (_raw_spin_trylock(lock)) {
|
||||||
|
spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
preempt_enable();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int __read_trylock(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
preempt_disable();
|
||||||
|
if (_raw_read_trylock(lock)) {
|
||||||
|
rwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
preempt_enable();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int __write_trylock(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
preempt_disable();
|
||||||
|
if (_raw_write_trylock(lock)) {
|
||||||
|
rwlock_acquire(&lock->dep_map, 0, 1, _RET_IP_);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
preempt_enable();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If lockdep is enabled then we use the non-preemption spin-ops
|
||||||
|
* even on CONFIG_PREEMPT, because lockdep assumes that interrupts are
|
||||||
|
* not re-enabled during lock-acquire (which the preempt-spin-ops do):
|
||||||
|
*/
|
||||||
|
#if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC)
|
||||||
|
|
||||||
|
static inline void __read_lock(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
preempt_disable();
|
||||||
|
rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
|
||||||
|
LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long __spin_lock_irqsave(spinlock_t *lock)
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
local_irq_save(flags);
|
||||||
|
preempt_disable();
|
||||||
|
spin_acquire(&lock->dep_map, 0, 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_LOCKDEP
|
||||||
|
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
|
||||||
|
#else
|
||||||
|
_raw_spin_lock_flags(lock, &flags);
|
||||||
|
#endif
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __spin_lock_irq(spinlock_t *lock)
|
||||||
|
{
|
||||||
|
local_irq_disable();
|
||||||
|
preempt_disable();
|
||||||
|
spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
||||||
|
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __spin_lock_bh(spinlock_t *lock)
|
||||||
|
{
|
||||||
|
local_bh_disable();
|
||||||
|
preempt_disable();
|
||||||
|
spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
||||||
|
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long __read_lock_irqsave(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
local_irq_save(flags);
|
||||||
|
preempt_disable();
|
||||||
|
rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
|
||||||
|
LOCK_CONTENDED_FLAGS(lock, _raw_read_trylock, _raw_read_lock,
|
||||||
|
_raw_read_lock_flags, &flags);
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __read_lock_irq(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
local_irq_disable();
|
||||||
|
preempt_disable();
|
||||||
|
rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
|
||||||
|
LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __read_lock_bh(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
local_bh_disable();
|
||||||
|
preempt_disable();
|
||||||
|
rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
|
||||||
|
LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long __write_lock_irqsave(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
local_irq_save(flags);
|
||||||
|
preempt_disable();
|
||||||
|
rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
||||||
|
LOCK_CONTENDED_FLAGS(lock, _raw_write_trylock, _raw_write_lock,
|
||||||
|
_raw_write_lock_flags, &flags);
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __write_lock_irq(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
local_irq_disable();
|
||||||
|
preempt_disable();
|
||||||
|
rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
||||||
|
LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __write_lock_bh(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
local_bh_disable();
|
||||||
|
preempt_disable();
|
||||||
|
rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
||||||
|
LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __spin_lock(spinlock_t *lock)
|
||||||
|
{
|
||||||
|
preempt_disable();
|
||||||
|
spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
||||||
|
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __write_lock(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
preempt_disable();
|
||||||
|
rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
||||||
|
LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_PREEMPT */
|
||||||
|
|
||||||
|
static inline void __spin_unlock(spinlock_t *lock)
|
||||||
|
{
|
||||||
|
spin_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_spin_unlock(lock);
|
||||||
|
preempt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __write_unlock(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_write_unlock(lock);
|
||||||
|
preempt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __read_unlock(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_read_unlock(lock);
|
||||||
|
preempt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __spin_unlock_irqrestore(spinlock_t *lock,
|
||||||
|
unsigned long flags)
|
||||||
|
{
|
||||||
|
spin_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_spin_unlock(lock);
|
||||||
|
local_irq_restore(flags);
|
||||||
|
preempt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __spin_unlock_irq(spinlock_t *lock)
|
||||||
|
{
|
||||||
|
spin_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_spin_unlock(lock);
|
||||||
|
local_irq_enable();
|
||||||
|
preempt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __spin_unlock_bh(spinlock_t *lock)
|
||||||
|
{
|
||||||
|
spin_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_spin_unlock(lock);
|
||||||
|
preempt_enable_no_resched();
|
||||||
|
local_bh_enable_ip((unsigned long)__builtin_return_address(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
|
||||||
|
{
|
||||||
|
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_read_unlock(lock);
|
||||||
|
local_irq_restore(flags);
|
||||||
|
preempt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __read_unlock_irq(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_read_unlock(lock);
|
||||||
|
local_irq_enable();
|
||||||
|
preempt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __read_unlock_bh(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_read_unlock(lock);
|
||||||
|
preempt_enable_no_resched();
|
||||||
|
local_bh_enable_ip((unsigned long)__builtin_return_address(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __write_unlock_irqrestore(rwlock_t *lock,
|
||||||
|
unsigned long flags)
|
||||||
|
{
|
||||||
|
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_write_unlock(lock);
|
||||||
|
local_irq_restore(flags);
|
||||||
|
preempt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __write_unlock_irq(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_write_unlock(lock);
|
||||||
|
local_irq_enable();
|
||||||
|
preempt_enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __write_unlock_bh(rwlock_t *lock)
|
||||||
|
{
|
||||||
|
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
||||||
|
_raw_write_unlock(lock);
|
||||||
|
preempt_enable_no_resched();
|
||||||
|
local_bh_enable_ip((unsigned long)__builtin_return_address(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int __spin_trylock_bh(spinlock_t *lock)
|
||||||
|
{
|
||||||
|
local_bh_disable();
|
||||||
|
preempt_disable();
|
||||||
|
if (_raw_spin_trylock(lock)) {
|
||||||
|
spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
preempt_enable_no_resched();
|
||||||
|
local_bh_enable_ip((unsigned long)__builtin_return_address(0));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __LINUX_SPINLOCK_API_SMP_H */
|
#endif /* __LINUX_SPINLOCK_API_SMP_H */
|
||||||
|
|
|
@ -23,40 +23,19 @@
|
||||||
|
|
||||||
int __lockfunc _spin_trylock(spinlock_t *lock)
|
int __lockfunc _spin_trylock(spinlock_t *lock)
|
||||||
{
|
{
|
||||||
preempt_disable();
|
return __spin_trylock(lock);
|
||||||
if (_raw_spin_trylock(lock)) {
|
|
||||||
spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
preempt_enable();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_spin_trylock);
|
EXPORT_SYMBOL(_spin_trylock);
|
||||||
|
|
||||||
int __lockfunc _read_trylock(rwlock_t *lock)
|
int __lockfunc _read_trylock(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
preempt_disable();
|
return __read_trylock(lock);
|
||||||
if (_raw_read_trylock(lock)) {
|
|
||||||
rwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
preempt_enable();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_read_trylock);
|
EXPORT_SYMBOL(_read_trylock);
|
||||||
|
|
||||||
int __lockfunc _write_trylock(rwlock_t *lock)
|
int __lockfunc _write_trylock(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
preempt_disable();
|
return __write_trylock(lock);
|
||||||
if (_raw_write_trylock(lock)) {
|
|
||||||
rwlock_acquire(&lock->dep_map, 0, 1, _RET_IP_);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
preempt_enable();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_write_trylock);
|
EXPORT_SYMBOL(_write_trylock);
|
||||||
|
|
||||||
|
@ -69,129 +48,74 @@ EXPORT_SYMBOL(_write_trylock);
|
||||||
|
|
||||||
void __lockfunc _read_lock(rwlock_t *lock)
|
void __lockfunc _read_lock(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
preempt_disable();
|
__read_lock(lock);
|
||||||
rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
|
|
||||||
LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_read_lock);
|
EXPORT_SYMBOL(_read_lock);
|
||||||
|
|
||||||
unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
|
unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
return __spin_lock_irqsave(lock);
|
||||||
|
|
||||||
local_irq_save(flags);
|
|
||||||
preempt_disable();
|
|
||||||
spin_acquire(&lock->dep_map, 0, 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_LOCKDEP
|
|
||||||
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
|
|
||||||
#else
|
|
||||||
_raw_spin_lock_flags(lock, &flags);
|
|
||||||
#endif
|
|
||||||
return flags;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_spin_lock_irqsave);
|
EXPORT_SYMBOL(_spin_lock_irqsave);
|
||||||
|
|
||||||
void __lockfunc _spin_lock_irq(spinlock_t *lock)
|
void __lockfunc _spin_lock_irq(spinlock_t *lock)
|
||||||
{
|
{
|
||||||
local_irq_disable();
|
__spin_lock_irq(lock);
|
||||||
preempt_disable();
|
|
||||||
spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
|
||||||
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_spin_lock_irq);
|
EXPORT_SYMBOL(_spin_lock_irq);
|
||||||
|
|
||||||
void __lockfunc _spin_lock_bh(spinlock_t *lock)
|
void __lockfunc _spin_lock_bh(spinlock_t *lock)
|
||||||
{
|
{
|
||||||
local_bh_disable();
|
__spin_lock_bh(lock);
|
||||||
preempt_disable();
|
|
||||||
spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
|
||||||
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_spin_lock_bh);
|
EXPORT_SYMBOL(_spin_lock_bh);
|
||||||
|
|
||||||
unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
|
unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
return __read_lock_irqsave(lock);
|
||||||
|
|
||||||
local_irq_save(flags);
|
|
||||||
preempt_disable();
|
|
||||||
rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
|
|
||||||
LOCK_CONTENDED_FLAGS(lock, _raw_read_trylock, _raw_read_lock,
|
|
||||||
_raw_read_lock_flags, &flags);
|
|
||||||
return flags;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_read_lock_irqsave);
|
EXPORT_SYMBOL(_read_lock_irqsave);
|
||||||
|
|
||||||
void __lockfunc _read_lock_irq(rwlock_t *lock)
|
void __lockfunc _read_lock_irq(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
local_irq_disable();
|
__read_lock_irq(lock);
|
||||||
preempt_disable();
|
|
||||||
rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
|
|
||||||
LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_read_lock_irq);
|
EXPORT_SYMBOL(_read_lock_irq);
|
||||||
|
|
||||||
void __lockfunc _read_lock_bh(rwlock_t *lock)
|
void __lockfunc _read_lock_bh(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
local_bh_disable();
|
__read_lock_bh(lock);
|
||||||
preempt_disable();
|
|
||||||
rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
|
|
||||||
LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_read_lock_bh);
|
EXPORT_SYMBOL(_read_lock_bh);
|
||||||
|
|
||||||
unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
|
unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
return __write_lock_irqsave(lock);
|
||||||
|
|
||||||
local_irq_save(flags);
|
|
||||||
preempt_disable();
|
|
||||||
rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
|
||||||
LOCK_CONTENDED_FLAGS(lock, _raw_write_trylock, _raw_write_lock,
|
|
||||||
_raw_write_lock_flags, &flags);
|
|
||||||
return flags;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_write_lock_irqsave);
|
EXPORT_SYMBOL(_write_lock_irqsave);
|
||||||
|
|
||||||
void __lockfunc _write_lock_irq(rwlock_t *lock)
|
void __lockfunc _write_lock_irq(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
local_irq_disable();
|
__write_lock_irq(lock);
|
||||||
preempt_disable();
|
|
||||||
rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
|
||||||
LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_write_lock_irq);
|
EXPORT_SYMBOL(_write_lock_irq);
|
||||||
|
|
||||||
void __lockfunc _write_lock_bh(rwlock_t *lock)
|
void __lockfunc _write_lock_bh(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
local_bh_disable();
|
__write_lock_bh(lock);
|
||||||
preempt_disable();
|
|
||||||
rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
|
||||||
LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_write_lock_bh);
|
EXPORT_SYMBOL(_write_lock_bh);
|
||||||
|
|
||||||
void __lockfunc _spin_lock(spinlock_t *lock)
|
void __lockfunc _spin_lock(spinlock_t *lock)
|
||||||
{
|
{
|
||||||
preempt_disable();
|
__spin_lock(lock);
|
||||||
spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
|
||||||
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(_spin_lock);
|
EXPORT_SYMBOL(_spin_lock);
|
||||||
|
|
||||||
void __lockfunc _write_lock(rwlock_t *lock)
|
void __lockfunc _write_lock(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
preempt_disable();
|
__write_lock(lock);
|
||||||
rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
|
|
||||||
LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(_write_lock);
|
EXPORT_SYMBOL(_write_lock);
|
||||||
|
|
||||||
#else /* CONFIG_PREEMPT: */
|
#else /* CONFIG_PREEMPT: */
|
||||||
|
@ -320,121 +244,79 @@ EXPORT_SYMBOL(_spin_lock_nest_lock);
|
||||||
|
|
||||||
void __lockfunc _spin_unlock(spinlock_t *lock)
|
void __lockfunc _spin_unlock(spinlock_t *lock)
|
||||||
{
|
{
|
||||||
spin_release(&lock->dep_map, 1, _RET_IP_);
|
__spin_unlock(lock);
|
||||||
_raw_spin_unlock(lock);
|
|
||||||
preempt_enable();
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_spin_unlock);
|
EXPORT_SYMBOL(_spin_unlock);
|
||||||
|
|
||||||
void __lockfunc _write_unlock(rwlock_t *lock)
|
void __lockfunc _write_unlock(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
__write_unlock(lock);
|
||||||
_raw_write_unlock(lock);
|
|
||||||
preempt_enable();
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_write_unlock);
|
EXPORT_SYMBOL(_write_unlock);
|
||||||
|
|
||||||
void __lockfunc _read_unlock(rwlock_t *lock)
|
void __lockfunc _read_unlock(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
__read_unlock(lock);
|
||||||
_raw_read_unlock(lock);
|
|
||||||
preempt_enable();
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_read_unlock);
|
EXPORT_SYMBOL(_read_unlock);
|
||||||
|
|
||||||
void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
|
void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
|
||||||
{
|
{
|
||||||
spin_release(&lock->dep_map, 1, _RET_IP_);
|
__spin_unlock_irqrestore(lock, flags);
|
||||||
_raw_spin_unlock(lock);
|
|
||||||
local_irq_restore(flags);
|
|
||||||
preempt_enable();
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_spin_unlock_irqrestore);
|
EXPORT_SYMBOL(_spin_unlock_irqrestore);
|
||||||
|
|
||||||
void __lockfunc _spin_unlock_irq(spinlock_t *lock)
|
void __lockfunc _spin_unlock_irq(spinlock_t *lock)
|
||||||
{
|
{
|
||||||
spin_release(&lock->dep_map, 1, _RET_IP_);
|
__spin_unlock_irq(lock);
|
||||||
_raw_spin_unlock(lock);
|
|
||||||
local_irq_enable();
|
|
||||||
preempt_enable();
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_spin_unlock_irq);
|
EXPORT_SYMBOL(_spin_unlock_irq);
|
||||||
|
|
||||||
void __lockfunc _spin_unlock_bh(spinlock_t *lock)
|
void __lockfunc _spin_unlock_bh(spinlock_t *lock)
|
||||||
{
|
{
|
||||||
spin_release(&lock->dep_map, 1, _RET_IP_);
|
__spin_unlock_bh(lock);
|
||||||
_raw_spin_unlock(lock);
|
|
||||||
preempt_enable_no_resched();
|
|
||||||
local_bh_enable_ip((unsigned long)__builtin_return_address(0));
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_spin_unlock_bh);
|
EXPORT_SYMBOL(_spin_unlock_bh);
|
||||||
|
|
||||||
void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
|
void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
|
||||||
{
|
{
|
||||||
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
__read_unlock_irqrestore(lock, flags);
|
||||||
_raw_read_unlock(lock);
|
|
||||||
local_irq_restore(flags);
|
|
||||||
preempt_enable();
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_read_unlock_irqrestore);
|
EXPORT_SYMBOL(_read_unlock_irqrestore);
|
||||||
|
|
||||||
void __lockfunc _read_unlock_irq(rwlock_t *lock)
|
void __lockfunc _read_unlock_irq(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
__read_unlock_irq(lock);
|
||||||
_raw_read_unlock(lock);
|
|
||||||
local_irq_enable();
|
|
||||||
preempt_enable();
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_read_unlock_irq);
|
EXPORT_SYMBOL(_read_unlock_irq);
|
||||||
|
|
||||||
void __lockfunc _read_unlock_bh(rwlock_t *lock)
|
void __lockfunc _read_unlock_bh(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
__read_unlock_bh(lock);
|
||||||
_raw_read_unlock(lock);
|
|
||||||
preempt_enable_no_resched();
|
|
||||||
local_bh_enable_ip((unsigned long)__builtin_return_address(0));
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_read_unlock_bh);
|
EXPORT_SYMBOL(_read_unlock_bh);
|
||||||
|
|
||||||
void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
|
void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
|
||||||
{
|
{
|
||||||
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
__write_unlock_irqrestore(lock, flags);
|
||||||
_raw_write_unlock(lock);
|
|
||||||
local_irq_restore(flags);
|
|
||||||
preempt_enable();
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_write_unlock_irqrestore);
|
EXPORT_SYMBOL(_write_unlock_irqrestore);
|
||||||
|
|
||||||
void __lockfunc _write_unlock_irq(rwlock_t *lock)
|
void __lockfunc _write_unlock_irq(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
__write_unlock_irq(lock);
|
||||||
_raw_write_unlock(lock);
|
|
||||||
local_irq_enable();
|
|
||||||
preempt_enable();
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_write_unlock_irq);
|
EXPORT_SYMBOL(_write_unlock_irq);
|
||||||
|
|
||||||
void __lockfunc _write_unlock_bh(rwlock_t *lock)
|
void __lockfunc _write_unlock_bh(rwlock_t *lock)
|
||||||
{
|
{
|
||||||
rwlock_release(&lock->dep_map, 1, _RET_IP_);
|
__write_unlock_bh(lock);
|
||||||
_raw_write_unlock(lock);
|
|
||||||
preempt_enable_no_resched();
|
|
||||||
local_bh_enable_ip((unsigned long)__builtin_return_address(0));
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_write_unlock_bh);
|
EXPORT_SYMBOL(_write_unlock_bh);
|
||||||
|
|
||||||
int __lockfunc _spin_trylock_bh(spinlock_t *lock)
|
int __lockfunc _spin_trylock_bh(spinlock_t *lock)
|
||||||
{
|
{
|
||||||
local_bh_disable();
|
return __spin_trylock_bh(lock);
|
||||||
preempt_disable();
|
|
||||||
if (_raw_spin_trylock(lock)) {
|
|
||||||
spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
preempt_enable_no_resched();
|
|
||||||
local_bh_enable_ip((unsigned long)__builtin_return_address(0));
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(_spin_trylock_bh);
|
EXPORT_SYMBOL(_spin_trylock_bh);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue