| Date | Tue, 13 Jul 2021 17:11:29 +0200 | From | Thomas Gleixner <> | Subject | [patch 35/50] locking/ww_mutex: Switch to _mutex_t |
| |
From: Thomas Gleixner <tglx@linutronix.de>
PREEMPT_RT replaces 'struct mutex' with a rtmutex based variant so all mutex operations are included into the priority inheritance scheme, but wants to utilize the ww_mutex specific part of the regular mutex implementation as is.
As the regular mutex and ww_mutex implementation are tightly coupled (ww_mutex has a 'struct mutex' inside) and share a lot of code (ww_mutex is mostly an extension) a simple replacement of 'struct mutex' does not work.
'struct mutex' has a typedef '_mutex_t' associated. Replace all 'struct mutex' references in ww_mutex with '_mutex_t' which allows to have a RT specific 'struct mutex' in the final step.
No functional change.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- include/linux/ww_mutex.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h index 455542a42123..4f56ec47c698 100644 --- a/include/linux/ww_mutex.h +++ b/include/linux/ww_mutex.h @@ -29,7 +29,7 @@ struct ww_class { }; struct ww_mutex { - struct mutex base; + _mutex_t base; struct ww_acquire_ctx *ctx; #ifdef CONFIG_DEBUG_MUTEXES struct ww_class *ww_class; @@ -330,7 +330,7 @@ extern void ww_mutex_unlock(struct ww_mutex *lock); */ static inline int __must_check ww_mutex_trylock(struct ww_mutex *lock) { - return mutex_trylock(&lock->base); + return _mutex_t_trylock(&lock->base); } /*** @@ -343,7 +343,7 @@ static inline int __must_check ww_mutex_trylock(struct ww_mutex *lock) */ static inline void ww_mutex_destroy(struct ww_mutex *lock) { - mutex_destroy(&lock->base); + _mutex_t_destroy(&lock->base); } /** @@ -354,7 +354,7 @@ static inline void ww_mutex_destroy(struct ww_mutex *lock) */ static inline bool ww_mutex_is_locked(struct ww_mutex *lock) { - return mutex_is_locked(&lock->base); + return _mutex_t_is_locked(&lock->base); } #endif
|