From patchwork Fri Apr 22 20:10:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 8915511 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 405C09F1D3 for ; Fri, 22 Apr 2016 20:10:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 50FA3201B9 for ; Fri, 22 Apr 2016 20:10:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6F0C220221 for ; Fri, 22 Apr 2016 20:10:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D5C266EF75; Fri, 22 Apr 2016 20:10:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9879C6EF73 for ; Fri, 22 Apr 2016 20:10:42 +0000 (UTC) Received: by mail-wm0-x233.google.com with SMTP id u206so42544091wme.1 for ; Fri, 22 Apr 2016 13:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id; bh=Ge5TYWANNbs6kgdMzftniZ40+oa3Wha8T2s5p6CsoHc=; b=lsYG5pyYSVNP2BXB4cC4JMvCN0Mp01HjJOUc+qKszVmFAiBHD6ZGR/2KvG7WJvaKlA 0l6B9WS1MMfW4Bw18Z+W6pXi+vi6E0UPh7PsejpWXrVT7HOQWoeYkmKFXD7koRBEVAPa 76W+nA7jRiiHnROKxf09oMmZrNd9iGZNoqFH8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ge5TYWANNbs6kgdMzftniZ40+oa3Wha8T2s5p6CsoHc=; b=nE4iuxpy2R6+k+xXXc74TiwGReJ4aB6g5Gxnfvfcvs+ntfaHP6PYBNThdcaBLScVl5 DjSi5AwG89iUpfxe+pA9fGE/5+KEOPvz8FK0oFRZ66SMBQzLXpAyPGJGwsGp9M9b44wW qS46L1J9ngE7vJokIUBPRY8bWjCQnoF/+LW/PEVBPRut5GPD/6Byx9OmMd25SitY7653 IBkA1mgrqJU7VcBV/5lZkaKazSHYvjmHdTPZBJ/BcDzwdxPmigf2+iHL/ZGVZ6I6H7bY E3GXGtHtyFZvXB4nsM4KrHj1KRUrkXfDs+4uz/mVo6LMXE2uQYhb0z81bHmRD2L72/d3 4oUg== X-Gm-Message-State: AOPr4FWyS8Aoe/+YeBzl4OpnXcpa1yY5VJ6xgfuPng6+PQkWxU971ZVdEG7wSe3w13mMpA== X-Received: by 10.28.23.10 with SMTP id 10mr5616339wmx.6.1461355839604; Fri, 22 Apr 2016 13:10:39 -0700 (PDT) Received: from wespe.ffwll.local ([2a02:168:56b5:0:6631:50ff:fe8d:fd2e]) by smtp.gmail.com with ESMTPSA id w79sm4912488wme.19.2016.04.22.13.10.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Apr 2016 13:10:39 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development , DRI Development Date: Fri, 22 Apr 2016 22:10:27 +0200 Message-Id: <1461355830-14338-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.5.0 Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 1/4] drm: Improve kerneldoc for new mode object refcounting X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Slipped through the cracks in my review. The one issue I spotted is that drm_mode_object_find now acquires references and can be used on FB objects, which caused follow-on bugs in get/set_prop ioctls. Follow-up patches will fix that. Cc: Dave Airlie Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index d078a5c34d48..52e6001a40e4 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -380,10 +380,9 @@ static struct drm_mode_object *_object_find(struct drm_device *dev, * @id: id of the mode object * @type: type of the mode object * - * Note that framebuffers cannot be looked up with this functions - since those - * are reference counted, they need special treatment. Even with - * DRM_MODE_OBJECT_ANY (although that will simply return NULL - * rather than WARN_ON()). + * This function is used to look up a modeset object. It will acquire a + * reference for reference counted objects. This reference must be dropped again + * by callind drm_mode_object_unreference(). */ struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type) @@ -398,6 +397,14 @@ struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, } EXPORT_SYMBOL(drm_mode_object_find); +/** + * drm_mode_object_unreference - incr the fb refcnt + * @obj: mode_object + * + * This functions decrements the object's refcount if it is a refcounted modeset + * object. It is a no-op on any other object. This is used to drop references + * acquired with drm_mode_object_reference(). + */ void drm_mode_object_unreference(struct drm_mode_object *obj) { if (obj->free_cb) { @@ -411,8 +418,9 @@ EXPORT_SYMBOL(drm_mode_object_unreference); * drm_mode_object_reference - incr the fb refcnt * @obj: mode_object * - * This function operates only on refcounted objects. - * This functions increments the object's refcount. + * This functions increments the object's refcount if it is a refcounted modeset + * object. It is a no-op on any other object. References should be dropped again + * by calling drm_mode_object_unreference(). */ void drm_mode_object_reference(struct drm_mode_object *obj) {