Commit d6cac0b6 authored by Waiman Long's avatar Waiman Long Committed by Ingo Molnar
Browse files

locking/mutex: Simplify <linux/mutex.h>



CONFIG_DEBUG_MUTEXES and CONFIG_PREEMPT_RT are mutually exclusive. They
can't be both set at the same time.  Move up the mutex_destroy() function
declaration and the __DEBUG_MUTEX_INITIALIZER() macro above the "#ifndef
CONFIG_PREEMPT_RT" section to eliminate duplicated mutex_destroy()
declaration.

Also remove the duplicated mutex_trylock() function declaration in the
CONFIG_PREEMPT_RT section.

Signed-off-by: default avatarWaiman Long <longman@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Reviewed-by: default avatarBoqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/r/20240222150540.79981-3-longman@redhat.com
parent ca4bc2e0
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -32,8 +32,6 @@
# define __DEP_MAP_MUTEX_INITIALIZER(lockname)
#endif

#ifndef CONFIG_PREEMPT_RT

#ifdef CONFIG_DEBUG_MUTEXES

# define __DEBUG_MUTEX_INITIALIZER(lockname)				\
@@ -49,6 +47,7 @@ static inline void mutex_destroy(struct mutex *lock) {}

#endif

#ifndef CONFIG_PREEMPT_RT
/**
 * mutex_init - initialize the mutex
 * @mutex: the mutex to be initialized
@@ -101,9 +100,6 @@ extern bool mutex_is_locked(struct mutex *lock);

extern void __mutex_rt_init(struct mutex *lock, const char *name,
			    struct lock_class_key *key);
extern int mutex_trylock(struct mutex *lock);

static inline void mutex_destroy(struct mutex *lock) { }

#define mutex_is_locked(l)	rt_mutex_base_is_locked(&(l)->rtmutex)