From: Sebastian Andrzej Siewior Date: Sun, 15 Aug 2021 21:27:54 +0000 (+0200) Subject: locking/rtmutex: Convert macros to inlines X-Git-Tag: accepted/tizen/unified/20230118.172025~6489^2~63 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=785159301bedea25fae9b20cae3d12377246e941;p=platform%2Fkernel%2Flinux-rpi.git locking/rtmutex: Convert macros to inlines Inlines are type-safe... Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20210815211302.610830960@linutronix.de --- diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index 1a7e3f8..5187add 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -141,8 +141,19 @@ static __always_inline void fixup_rt_mutex_waiters(struct rt_mutex *lock) * set up. */ #ifndef CONFIG_DEBUG_RT_MUTEXES -# define rt_mutex_cmpxchg_acquire(l,c,n) (cmpxchg_acquire(&l->owner, c, n) == c) -# define rt_mutex_cmpxchg_release(l,c,n) (cmpxchg_release(&l->owner, c, n) == c) +static __always_inline bool rt_mutex_cmpxchg_acquire(struct rt_mutex *lock, + struct task_struct *old, + struct task_struct *new) +{ + return cmpxchg_acquire(&lock->owner, old, new) == old; +} + +static __always_inline bool rt_mutex_cmpxchg_release(struct rt_mutex *lock, + struct task_struct *old, + struct task_struct *new) +{ + return cmpxchg_release(&lock->owner, old, new) == old; +} /* * Callers must hold the ->wait_lock -- which is the whole purpose as we force @@ -201,8 +212,20 @@ static __always_inline bool unlock_rt_mutex_safe(struct rt_mutex *lock, } #else -# define rt_mutex_cmpxchg_acquire(l,c,n) (0) -# define rt_mutex_cmpxchg_release(l,c,n) (0) +static __always_inline bool rt_mutex_cmpxchg_acquire(struct rt_mutex *lock, + struct task_struct *old, + struct task_struct *new) +{ + return false; + +} + +static __always_inline bool rt_mutex_cmpxchg_release(struct rt_mutex *lock, + struct task_struct *old, + struct task_struct *new) +{ + return false; +} static __always_inline void mark_rt_mutex_waiters(struct rt_mutex *lock) {