[PATCH v2 04/11] locking/ww_mutex: Set use_ww_ctx even when locking without a context
Peter Zijlstra
peterz at infradead.org
Tue Dec 6 15:14:59 UTC 2016
On Thu, Dec 01, 2016 at 03:06:47PM +0100, Nicolai Hähnle wrote:
> +++ b/include/linux/ww_mutex.h
> @@ -222,11 +222,7 @@ extern int __must_check __ww_mutex_lock_interruptible(struct ww_mutex *lock,
> */
> static inline int ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
> {
> - if (ctx)
> - return __ww_mutex_lock(lock, ctx);
> -
> - mutex_lock(&lock->base);
> - return 0;
> + return __ww_mutex_lock(lock, ctx);
> }
>
> /**
> @@ -262,10 +258,7 @@ static inline int ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ct
> static inline int __must_check ww_mutex_lock_interruptible(struct ww_mutex *lock,
> struct ww_acquire_ctx *ctx)
> {
> - if (ctx)
> - return __ww_mutex_lock_interruptible(lock, ctx);
> - else
> - return mutex_lock_interruptible(&lock->base);
> + return __ww_mutex_lock_interruptible(lock, ctx);
> }
>
After this the entire point of __ww_mutex_lock*() is gone, right? Might
as well rename them to ww_mutex_lock() and remove this pointless
wrapper.
More information about the dri-devel
mailing list