Skip to content

Commit d6cac0b

Browse files
Waiman-LongIngo Molnar
authored andcommitted
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: Waiman Long <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ca4bc2e commit d6cac0b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

include/linux/mutex.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@
3232
# define __DEP_MAP_MUTEX_INITIALIZER(lockname)
3333
#endif
3434

35-
#ifndef CONFIG_PREEMPT_RT
36-
3735
#ifdef CONFIG_DEBUG_MUTEXES
3836

39-
#define __DEBUG_MUTEX_INITIALIZER(lockname) \
37+
# define __DEBUG_MUTEX_INITIALIZER(lockname) \
4038
, .magic = &lockname
4139

4240
extern void mutex_destroy(struct mutex *lock);
@@ -49,6 +47,7 @@ static inline void mutex_destroy(struct mutex *lock) {}
4947

5048
#endif
5149

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

102101
extern void __mutex_rt_init(struct mutex *lock, const char *name,
103102
struct lock_class_key *key);
104-
extern int mutex_trylock(struct mutex *lock);
105-
106-
static inline void mutex_destroy(struct mutex *lock) { }
107103

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

0 commit comments

Comments
 (0)