Commit a321fb90 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

locking/mutex: Consolidate core headers, remove kernel/locking/mutex-debug.h

Having two header files which contain just the non-debug and debug variants
is mostly waste of disc space and has no real value. Stick the debug
variants into the common mutex.h file as counterpart to the stubs for the
non-debug case.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210815211303.995350521@linutronix.de
parent 715f7f9e
/* /*
* kernel/mutex-debug.c
*
* Debugging code for mutexes * Debugging code for mutexes
* *
* Started by Ingo Molnar: * Started by Ingo Molnar:
...@@ -22,7 +20,7 @@ ...@@ -22,7 +20,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/debug_locks.h> #include <linux/debug_locks.h>
#include "mutex-debug.h" #include "mutex.h"
/* /*
* Must be called with lock->wait_lock held. * Must be called with lock->wait_lock held.
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Mutexes: blocking mutual exclusion locks
*
* started by Ingo Molnar:
*
* Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
*
* This file contains mutex debugging related internal declarations,
* prototypes and inline functions, for the CONFIG_DEBUG_MUTEXES case.
* More details are in kernel/mutex-debug.c.
*/
/*
* This must be called with lock->wait_lock held.
*/
extern void debug_mutex_lock_common(struct mutex *lock,
struct mutex_waiter *waiter);
extern void debug_mutex_wake_waiter(struct mutex *lock,
struct mutex_waiter *waiter);
extern void debug_mutex_free_waiter(struct mutex_waiter *waiter);
extern void debug_mutex_add_waiter(struct mutex *lock,
struct mutex_waiter *waiter,
struct task_struct *task);
extern void debug_mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,
struct task_struct *task);
extern void debug_mutex_unlock(struct mutex *lock);
extern void debug_mutex_init(struct mutex *lock, const char *name,
struct lock_class_key *key);
...@@ -30,11 +30,11 @@ ...@@ -30,11 +30,11 @@
#include <linux/debug_locks.h> #include <linux/debug_locks.h>
#include <linux/osq_lock.h> #include <linux/osq_lock.h>
#include "mutex.h"
#ifdef CONFIG_DEBUG_MUTEXES #ifdef CONFIG_DEBUG_MUTEXES
# include "mutex-debug.h"
# define MUTEX_WARN_ON(cond) DEBUG_LOCKS_WARN_ON(cond) # define MUTEX_WARN_ON(cond) DEBUG_LOCKS_WARN_ON(cond)
#else #else
# include "mutex.h"
# define MUTEX_WARN_ON(cond) # define MUTEX_WARN_ON(cond)
#endif #endif
......
...@@ -5,19 +5,28 @@ ...@@ -5,19 +5,28 @@
* started by Ingo Molnar: * started by Ingo Molnar:
* *
* Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
*
* This file contains mutex debugging related internal prototypes, for the
* !CONFIG_DEBUG_MUTEXES case. Most of them are NOPs:
*/ */
#define debug_mutex_wake_waiter(lock, waiter) do { } while (0) #ifdef CONFIG_DEBUG_MUTEXES
#define debug_mutex_free_waiter(waiter) do { } while (0) extern void debug_mutex_lock_common(struct mutex *lock,
#define debug_mutex_add_waiter(lock, waiter, ti) do { } while (0) struct mutex_waiter *waiter);
#define debug_mutex_remove_waiter(lock, waiter, ti) do { } while (0) extern void debug_mutex_wake_waiter(struct mutex *lock,
#define debug_mutex_unlock(lock) do { } while (0) struct mutex_waiter *waiter);
#define debug_mutex_init(lock, name, key) do { } while (0) extern void debug_mutex_free_waiter(struct mutex_waiter *waiter);
extern void debug_mutex_add_waiter(struct mutex *lock,
static inline void struct mutex_waiter *waiter,
debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter) struct task_struct *task);
{ extern void debug_mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,
} struct task_struct *task);
extern void debug_mutex_unlock(struct mutex *lock);
extern void debug_mutex_init(struct mutex *lock, const char *name,
struct lock_class_key *key);
#else /* CONFIG_DEBUG_MUTEXES */
# define debug_mutex_lock_common(lock, waiter) do { } while (0)
# define debug_mutex_wake_waiter(lock, waiter) do { } while (0)
# define debug_mutex_free_waiter(waiter) do { } while (0)
# define debug_mutex_add_waiter(lock, waiter, ti) do { } while (0)
# define debug_mutex_remove_waiter(lock, waiter, ti) do { } while (0)
# define debug_mutex_unlock(lock) do { } while (0)
# define debug_mutex_init(lock, name, key) do { } while (0)
#endif /* !CONFIG_DEBUG_MUTEXES */
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