Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753510AbcLFPPU (ORCPT ); Tue, 6 Dec 2016 10:15:20 -0500 Received: from merlin.infradead.org ([205.233.59.134]:36824 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751798AbcLFPPT (ORCPT ); Tue, 6 Dec 2016 10:15:19 -0500 Date: Tue, 6 Dec 2016 16:14:59 +0100 From: Peter Zijlstra To: Nicolai =?iso-8859-1?Q?H=E4hnle?= Cc: linux-kernel@vger.kernel.org, Nicolai =?iso-8859-1?Q?H=E4hnle?= , Ingo Molnar , Maarten Lankhorst , Daniel Vetter , Chris Wilson , dri-devel@lists.freedesktop.org Subject: Re: [PATCH v2 04/11] locking/ww_mutex: Set use_ww_ctx even when locking without a context Message-ID: <20161206151459.GU3045@worktop.programming.kicks-ass.net> References: <1480601214-26583-1-git-send-email-nhaehnle@gmail.com> <1480601214-26583-5-git-send-email-nhaehnle@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1480601214-26583-5-git-send-email-nhaehnle@gmail.com> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1021 Lines: 30 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.