From patchwork Thu Jul 20 16:07:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 108419 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2325114qge; Thu, 20 Jul 2017 09:08:07 -0700 (PDT) X-Received: by 10.98.102.85 with SMTP id a82mr4502969pfc.82.1500566887313; Thu, 20 Jul 2017 09:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500566887; cv=none; d=google.com; s=arc-20160816; b=cmfOfOVGj7lYxht5Gx3h20pkhi9aG7GV0GaN24TmacLuJD+lCMFbL+iCKseMgTVyQ7 03XH9sDg+t02tBm0h7ysXhhzz9yP/kKeYB46Dyp5wkxwjJu1+9Ka886a7JmbbNs93kmW qUjnD+jb+iAwE+0UEtu2Vql2EvcaLZwTZ1Tq3hIXXvzzbQXn+v6GVpA5j/xh1kf2J2EV HphimVzTd+TSiPvXXVq2AMQW50/2GDL63xxaHGRu79aNX4cDtmtO6/8BS34Eji/MB6P4 dK7Qu1ydn4rzi6/ZIShjmlVMMBO+cRy0iiI8q8N1GKsvVKcAEIFX/Wi65t4W8BPiVtl6 qfAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=7lOyyJwMiN0U1e+XRK6zYI7z6ZS0n7Q3qvBP4dVQbmo=; b=dJz9sOHuKNYL9pPqiOOq458KWUeF9ID5JHoMTVFXsm7LFSE+kvMAvTnUG71k0YNBY1 Bmra7pHtf/brhbv+9igaIPJLzBJc0VnjnlOHBr7HmfY1nG/xGBPFuDuy3MXYMKvQ9ycV N6Zrg4Bu+rrrbn/YdCjg7zTneyBwqL79NxYSWp+iqPOMM3W9BqCCFiADWoGUPsTlMHoL IS0nmFbYau1jnYetaOIBzlA1nKGdJoLrWl7iRca00MWsoZr6fb4DPUmKAayAb3AAqp00 Qg6P4sZ0hyt+7mk5h7hGAHbHrxjXgUQ79a5mq/ah7egvmCrBOlFmnR4yET4dJD0ZHVID pycA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 22si1859105pgy.147.2017.07.20.09.08.07; Thu, 20 Jul 2017 09:08:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935944AbdGTQIE (ORCPT + 25 others); Thu, 20 Jul 2017 12:08:04 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.140]:51951 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933887AbdGTQID (ORCPT ); Thu, 20 Jul 2017 12:08:03 -0400 Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.9]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v6KG7mog003250; Thu, 20 Jul 2017 17:07:48 +0100 From: Liviu Dudau To: Daniel Vetter Cc: Jani Nikula , Sean Paul , David Airlie , DRI devel , LKML Subject: [PATCH] drm: Improve kerneldoc for drm_modeset_lock Date: Thu, 20 Jul 2017 17:07:48 +0100 Message-Id: <20170720160748.12856-1-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.13.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/gpu/drm/drm_modeset_lock.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- 2.13.2 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)