Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936164AbdGTSjd (ORCPT ); Thu, 20 Jul 2017 14:39:33 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:38831 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932226AbdGTSjb (ORCPT ); Thu, 20 Jul 2017 14:39:31 -0400 Date: Thu, 20 Jul 2017 20:39:27 +0200 From: Daniel Vetter To: Liviu Dudau Cc: Daniel Vetter , Jani Nikula , Sean Paul , David Airlie , DRI devel , LKML Subject: Re: [PATCH] drm: Improve kerneldoc for drm_modeset_lock Message-ID: <20170720183927.wrgxyjc3rdmjtbmg@phenom.ffwll.local> Mail-Followup-To: Liviu Dudau , Jani Nikula , Sean Paul , David Airlie , DRI devel , LKML References: <20170720160748.12856-1-Liviu.Dudau@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170720160748.12856-1-Liviu.Dudau@arm.com> X-Operating-System: Linux phenom 4.11.0-1-amd64 User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2203 Lines: 56 On Thu, Jul 20, 2017 at 05:07:48PM +0100, Liviu Dudau wrote: > Explain better when the drm_modeset_acquire_ctx parameter can > be skipped for drm_modeset_lock() call. > > Signed-off-by: Liviu Dudau > Cc: Daniel Vetter Applied, thanks. -Daniel > --- > drivers/gpu/drm/drm_modeset_lock.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c > index 64ef09a6cccb..af4e906c630d 100644 > --- a/drivers/gpu/drm/drm_modeset_lock.c > +++ b/drivers/gpu/drm/drm_modeset_lock.c > @@ -52,7 +52,12 @@ > * drm_modeset_drop_locks(&ctx); > * drm_modeset_acquire_fini(&ctx); > * > - * On top of of these per-object locks using &ww_mutex there's also an overall > + * If all that is needed is a single modeset lock, then the &struct > + * drm_modeset_acquire_ctx is not needed and the locking can be simplified > + * by passing a NULL instead of ctx in the drm_modeset_lock() > + * call and, when done, by calling drm_modeset_unlock(). > + * > + * On top of these per-object locks using &ww_mutex there's also an overall > * &drm_mode_config.mutex, for protecting everything else. Mostly this means > * probe state of connectors, and preventing hotplug add/removal of connectors. > * > @@ -313,11 +318,14 @@ EXPORT_SYMBOL(drm_modeset_lock_init); > * @lock: lock to take > * @ctx: acquire ctx > * > - * If ctx is not NULL, then its ww acquire context is used and the > + * If @ctx is not NULL, then its ww acquire context is used and the > * lock will be tracked by the context and can be released by calling > * drm_modeset_drop_locks(). If -EDEADLK is returned, this means a > * deadlock scenario has been detected and it is an error to attempt > * to take any more locks without first calling drm_modeset_backoff(). > + * > + * If @ctx is NULL then the function call behaves like a normal, > + * non-nesting mutex_lock() call. > */ > int drm_modeset_lock(struct drm_modeset_lock *lock, > struct drm_modeset_acquire_ctx *ctx) > -- > 2.13.2 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch