dynamic_debug: factor vpr_info_dq out of ddebug_parse_query
[linux-2.6.git] / lib / spinlock_debug.c
index e705848..5f3eacd 100644 (file)
@@ -49,13 +49,10 @@ void __rwlock_init(rwlock_t *lock, const char *name,
 
 EXPORT_SYMBOL(__rwlock_init);
 
-static void spin_bug(raw_spinlock_t *lock, const char *msg)
+static void spin_dump(raw_spinlock_t *lock, const char *msg)
 {
        struct task_struct *owner = NULL;
 
-       if (!debug_locks_off())
-               return;
-
        if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT)
                owner = lock->owner;
        printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n",
@@ -70,6 +67,14 @@ static void spin_bug(raw_spinlock_t *lock, const char *msg)
        dump_stack();
 }
 
+static void spin_bug(raw_spinlock_t *lock, const char *msg)
+{
+       if (!debug_locks_off())
+               return;
+
+       spin_dump(lock, msg);
+}
+
 #define SPIN_BUG_ON(cond, lock, msg) if (unlikely(cond)) spin_bug(lock, msg)
 
 static inline void
@@ -113,11 +118,7 @@ static void __spin_lock_debug(raw_spinlock_t *lock)
                /* lockup suspected: */
                if (print_once) {
                        print_once = 0;
-                       printk(KERN_EMERG "BUG: spinlock lockup on CPU#%d, "
-                                       "%s/%d, %p\n",
-                               raw_smp_processor_id(), current->comm,
-                               task_pid_nr(current), lock);
-                       dump_stack();
+                       spin_dump(lock, "lockup");
 #ifdef CONFIG_SMP
                        trigger_all_cpu_backtrace();
 #endif
@@ -125,7 +126,7 @@ static void __spin_lock_debug(raw_spinlock_t *lock)
        }
 }
 
-void _raw_spin_lock(raw_spinlock_t *lock)
+void do_raw_spin_lock(raw_spinlock_t *lock)
 {
        debug_spin_lock_before(lock);
        if (unlikely(!arch_spin_trylock(&lock->raw_lock)))
@@ -133,7 +134,7 @@ void _raw_spin_lock(raw_spinlock_t *lock)
        debug_spin_lock_after(lock);
 }
 
-int _raw_spin_trylock(raw_spinlock_t *lock)
+int do_raw_spin_trylock(raw_spinlock_t *lock)
 {
        int ret = arch_spin_trylock(&lock->raw_lock);
 
@@ -148,7 +149,7 @@ int _raw_spin_trylock(raw_spinlock_t *lock)
        return ret;
 }
 
-void _raw_spin_unlock(raw_spinlock_t *lock)
+void do_raw_spin_unlock(raw_spinlock_t *lock)
 {
        debug_spin_unlock(lock);
        arch_spin_unlock(&lock->raw_lock);
@@ -193,13 +194,13 @@ static void __read_lock_debug(rwlock_t *lock)
 }
 #endif
 
-void _raw_read_lock(rwlock_t *lock)
+void do_raw_read_lock(rwlock_t *lock)
 {
        RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic");
        arch_read_lock(&lock->raw_lock);
 }
 
-int _raw_read_trylock(rwlock_t *lock)
+int do_raw_read_trylock(rwlock_t *lock)
 {
        int ret = arch_read_trylock(&lock->raw_lock);
 
@@ -212,7 +213,7 @@ int _raw_read_trylock(rwlock_t *lock)
        return ret;
 }
 
-void _raw_read_unlock(rwlock_t *lock)
+void do_raw_read_unlock(rwlock_t *lock)
 {
        RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic");
        arch_read_unlock(&lock->raw_lock);
@@ -268,14 +269,14 @@ static void __write_lock_debug(rwlock_t *lock)
 }
 #endif
 
-void _raw_write_lock(rwlock_t *lock)
+void do_raw_write_lock(rwlock_t *lock)
 {
        debug_write_lock_before(lock);
        arch_write_lock(&lock->raw_lock);
        debug_write_lock_after(lock);
 }
 
-int _raw_write_trylock(rwlock_t *lock)
+int do_raw_write_trylock(rwlock_t *lock)
 {
        int ret = arch_write_trylock(&lock->raw_lock);
 
@@ -290,7 +291,7 @@ int _raw_write_trylock(rwlock_t *lock)
        return ret;
 }
 
-void _raw_write_unlock(rwlock_t *lock)
+void do_raw_write_unlock(rwlock_t *lock)
 {
        debug_write_unlock(lock);
        arch_write_unlock(&lock->raw_lock);