Commit b7b40ade authored by Thomas Gleixner's avatar Thomas Gleixner

locking: Reorder functions in spinlock.c

Separate spin_lock and rw_lock functions. Preempt-RT needs to exclude
the rw_lock functions from being compiled. The reordering allows to do
that with a single #ifdef.

No functional change.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
parent 3ea6b3d0
...@@ -113,41 +113,6 @@ BUILD_LOCK_OPS(write, rwlock); ...@@ -113,41 +113,6 @@ BUILD_LOCK_OPS(write, rwlock);
#endif #endif
#ifdef CONFIG_DEBUG_LOCK_ALLOC
void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass)
{
preempt_disable();
spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_);
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
}
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_);
LOCK_CONTENDED_FLAGS(lock, _raw_spin_trylock, _raw_spin_lock,
_raw_spin_lock_flags, &flags);
return flags;
}
EXPORT_SYMBOL(_spin_lock_irqsave_nested);
void __lockfunc _spin_lock_nest_lock(spinlock_t *lock,
struct lockdep_map *nest_lock)
{
preempt_disable();
spin_acquire_nest(&lock->dep_map, 0, 0, nest_lock, _RET_IP_);
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
}
EXPORT_SYMBOL(_spin_lock_nest_lock);
#endif
#ifndef CONFIG_INLINE_SPIN_TRYLOCK #ifndef CONFIG_INLINE_SPIN_TRYLOCK
int __lockfunc _spin_trylock(spinlock_t *lock) int __lockfunc _spin_trylock(spinlock_t *lock)
{ {
...@@ -156,28 +121,20 @@ int __lockfunc _spin_trylock(spinlock_t *lock) ...@@ -156,28 +121,20 @@ int __lockfunc _spin_trylock(spinlock_t *lock)
EXPORT_SYMBOL(_spin_trylock); EXPORT_SYMBOL(_spin_trylock);
#endif #endif
#ifndef CONFIG_INLINE_READ_TRYLOCK #ifndef CONFIG_INLINE_SPIN_TRYLOCK_BH
int __lockfunc _read_trylock(rwlock_t *lock) int __lockfunc _spin_trylock_bh(spinlock_t *lock)
{
return __read_trylock(lock);
}
EXPORT_SYMBOL(_read_trylock);
#endif
#ifndef CONFIG_INLINE_WRITE_TRYLOCK
int __lockfunc _write_trylock(rwlock_t *lock)
{ {
return __write_trylock(lock); return __spin_trylock_bh(lock);
} }
EXPORT_SYMBOL(_write_trylock); EXPORT_SYMBOL(_spin_trylock_bh);
#endif #endif
#ifndef CONFIG_INLINE_READ_LOCK #ifndef CONFIG_INLINE_SPIN_LOCK
void __lockfunc _read_lock(rwlock_t *lock) void __lockfunc _spin_lock(spinlock_t *lock)
{ {
__read_lock(lock); __spin_lock(lock);
} }
EXPORT_SYMBOL(_read_lock); EXPORT_SYMBOL(_spin_lock);
#endif #endif
#ifndef CONFIG_INLINE_SPIN_LOCK_IRQSAVE #ifndef CONFIG_INLINE_SPIN_LOCK_IRQSAVE
...@@ -204,84 +161,76 @@ void __lockfunc _spin_lock_bh(spinlock_t *lock) ...@@ -204,84 +161,76 @@ void __lockfunc _spin_lock_bh(spinlock_t *lock)
EXPORT_SYMBOL(_spin_lock_bh); EXPORT_SYMBOL(_spin_lock_bh);
#endif #endif
#ifndef CONFIG_INLINE_READ_LOCK_IRQSAVE #ifndef CONFIG_INLINE_SPIN_UNLOCK
unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) void __lockfunc _spin_unlock(spinlock_t *lock)
{
return __read_lock_irqsave(lock);
}
EXPORT_SYMBOL(_read_lock_irqsave);
#endif
#ifndef CONFIG_INLINE_READ_LOCK_IRQ
void __lockfunc _read_lock_irq(rwlock_t *lock)
{ {
__read_lock_irq(lock); __spin_unlock(lock);
} }
EXPORT_SYMBOL(_read_lock_irq); EXPORT_SYMBOL(_spin_unlock);
#endif #endif
#ifndef CONFIG_INLINE_READ_LOCK_BH #ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE
void __lockfunc _read_lock_bh(rwlock_t *lock) void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
{ {
__read_lock_bh(lock); __spin_unlock_irqrestore(lock, flags);
} }
EXPORT_SYMBOL(_read_lock_bh); EXPORT_SYMBOL(_spin_unlock_irqrestore);
#endif #endif
#ifndef CONFIG_INLINE_WRITE_LOCK_IRQSAVE #ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQ
unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) void __lockfunc _spin_unlock_irq(spinlock_t *lock)
{ {
return __write_lock_irqsave(lock); __spin_unlock_irq(lock);
} }
EXPORT_SYMBOL(_write_lock_irqsave); EXPORT_SYMBOL(_spin_unlock_irq);
#endif #endif
#ifndef CONFIG_INLINE_WRITE_LOCK_IRQ #ifndef CONFIG_INLINE_SPIN_UNLOCK_BH
void __lockfunc _write_lock_irq(rwlock_t *lock) void __lockfunc _spin_unlock_bh(spinlock_t *lock)
{ {
__write_lock_irq(lock); __spin_unlock_bh(lock);
} }
EXPORT_SYMBOL(_write_lock_irq); EXPORT_SYMBOL(_spin_unlock_bh);
#endif #endif
#ifndef CONFIG_INLINE_WRITE_LOCK_BH #ifndef CONFIG_INLINE_READ_TRYLOCK
void __lockfunc _write_lock_bh(rwlock_t *lock) int __lockfunc _read_trylock(rwlock_t *lock)
{ {
__write_lock_bh(lock); return __read_trylock(lock);
} }
EXPORT_SYMBOL(_write_lock_bh); EXPORT_SYMBOL(_read_trylock);
#endif #endif
#ifndef CONFIG_INLINE_SPIN_LOCK #ifndef CONFIG_INLINE_READ_LOCK
void __lockfunc _spin_lock(spinlock_t *lock) void __lockfunc _read_lock(rwlock_t *lock)
{ {
__spin_lock(lock); __read_lock(lock);
} }
EXPORT_SYMBOL(_spin_lock); EXPORT_SYMBOL(_read_lock);
#endif #endif
#ifndef CONFIG_INLINE_WRITE_LOCK #ifndef CONFIG_INLINE_READ_LOCK_IRQSAVE
void __lockfunc _write_lock(rwlock_t *lock) unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
{ {
__write_lock(lock); return __read_lock_irqsave(lock);
} }
EXPORT_SYMBOL(_write_lock); EXPORT_SYMBOL(_read_lock_irqsave);
#endif #endif
#ifndef CONFIG_INLINE_SPIN_UNLOCK #ifndef CONFIG_INLINE_READ_LOCK_IRQ
void __lockfunc _spin_unlock(spinlock_t *lock) void __lockfunc _read_lock_irq(rwlock_t *lock)
{ {
__spin_unlock(lock); __read_lock_irq(lock);
} }
EXPORT_SYMBOL(_spin_unlock); EXPORT_SYMBOL(_read_lock_irq);
#endif #endif
#ifndef CONFIG_INLINE_WRITE_UNLOCK #ifndef CONFIG_INLINE_READ_LOCK_BH
void __lockfunc _write_unlock(rwlock_t *lock) void __lockfunc _read_lock_bh(rwlock_t *lock)
{ {
__write_unlock(lock); __read_lock_bh(lock);
} }
EXPORT_SYMBOL(_write_unlock); EXPORT_SYMBOL(_read_lock_bh);
#endif #endif
#ifndef CONFIG_INLINE_READ_UNLOCK #ifndef CONFIG_INLINE_READ_UNLOCK
...@@ -292,30 +241,6 @@ void __lockfunc _read_unlock(rwlock_t *lock) ...@@ -292,30 +241,6 @@ void __lockfunc _read_unlock(rwlock_t *lock)
EXPORT_SYMBOL(_read_unlock); EXPORT_SYMBOL(_read_unlock);
#endif #endif
#ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE
void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
{
__spin_unlock_irqrestore(lock, flags);
}
EXPORT_SYMBOL(_spin_unlock_irqrestore);
#endif
#ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQ
void __lockfunc _spin_unlock_irq(spinlock_t *lock)
{
__spin_unlock_irq(lock);
}
EXPORT_SYMBOL(_spin_unlock_irq);
#endif
#ifndef CONFIG_INLINE_SPIN_UNLOCK_BH
void __lockfunc _spin_unlock_bh(spinlock_t *lock)
{
__spin_unlock_bh(lock);
}
EXPORT_SYMBOL(_spin_unlock_bh);
#endif
#ifndef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE #ifndef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE
void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
{ {
...@@ -340,6 +265,54 @@ void __lockfunc _read_unlock_bh(rwlock_t *lock) ...@@ -340,6 +265,54 @@ void __lockfunc _read_unlock_bh(rwlock_t *lock)
EXPORT_SYMBOL(_read_unlock_bh); EXPORT_SYMBOL(_read_unlock_bh);
#endif #endif
#ifndef CONFIG_INLINE_WRITE_TRYLOCK
int __lockfunc _write_trylock(rwlock_t *lock)
{
return __write_trylock(lock);
}
EXPORT_SYMBOL(_write_trylock);
#endif
#ifndef CONFIG_INLINE_WRITE_LOCK
void __lockfunc _write_lock(rwlock_t *lock)
{
__write_lock(lock);
}
EXPORT_SYMBOL(_write_lock);
#endif
#ifndef CONFIG_INLINE_WRITE_LOCK_IRQSAVE
unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
{
return __write_lock_irqsave(lock);
}
EXPORT_SYMBOL(_write_lock_irqsave);
#endif
#ifndef CONFIG_INLINE_WRITE_LOCK_IRQ
void __lockfunc _write_lock_irq(rwlock_t *lock)
{
__write_lock_irq(lock);
}
EXPORT_SYMBOL(_write_lock_irq);
#endif
#ifndef CONFIG_INLINE_WRITE_LOCK_BH
void __lockfunc _write_lock_bh(rwlock_t *lock)
{
__write_lock_bh(lock);
}
EXPORT_SYMBOL(_write_lock_bh);
#endif
#ifndef CONFIG_INLINE_WRITE_UNLOCK
void __lockfunc _write_unlock(rwlock_t *lock)
{
__write_unlock(lock);
}
EXPORT_SYMBOL(_write_unlock);
#endif
#ifndef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE #ifndef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE
void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
{ {
...@@ -364,12 +337,39 @@ void __lockfunc _write_unlock_bh(rwlock_t *lock) ...@@ -364,12 +337,39 @@ void __lockfunc _write_unlock_bh(rwlock_t *lock)
EXPORT_SYMBOL(_write_unlock_bh); EXPORT_SYMBOL(_write_unlock_bh);
#endif #endif
#ifndef CONFIG_INLINE_SPIN_TRYLOCK_BH #ifdef CONFIG_DEBUG_LOCK_ALLOC
int __lockfunc _spin_trylock_bh(spinlock_t *lock)
void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass)
{ {
return __spin_trylock_bh(lock); preempt_disable();
spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_);
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
} }
EXPORT_SYMBOL(_spin_trylock_bh); 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_);
LOCK_CONTENDED_FLAGS(lock, _raw_spin_trylock, _raw_spin_lock,
_raw_spin_lock_flags, &flags);
return flags;
}
EXPORT_SYMBOL(_spin_lock_irqsave_nested);
void __lockfunc _spin_lock_nest_lock(spinlock_t *lock,
struct lockdep_map *nest_lock)
{
preempt_disable();
spin_acquire_nest(&lock->dep_map, 0, 0, nest_lock, _RET_IP_);
LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
}
EXPORT_SYMBOL(_spin_lock_nest_lock);
#endif #endif
notrace int in_lock_functions(unsigned long addr) notrace int in_lock_functions(unsigned long addr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment