From patchwork Fri Aug 29 10:12:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 4809821 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 634FDC0338 for ; Fri, 29 Aug 2014 10:13:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C2C62012E for ; Fri, 29 Aug 2014 10:13:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8CF8B20136 for ; Fri, 29 Aug 2014 10:13:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FBA16E69A; Fri, 29 Aug 2014 03:13:26 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42]) by gabe.freedesktop.org (Postfix) with ESMTP id 67C476E695 for ; Fri, 29 Aug 2014 03:13:25 -0700 (PDT) Received: by mail-wg0-f42.google.com with SMTP id b13so1930727wgh.25 for ; Fri, 29 Aug 2014 03:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1LsvOECUvKrkotCer5tGOiIdsHjfTBN5ZgJAaf37q0Y=; b=gXlDhd74j8923nH+1mwWvk5WfpHZdl1T/BvaPkGdJnJJPdQhI5kW7i4eWn/hiKkNVq 4aRlFUkIm5/yQ4vmSD8SvTHdKxc2q6+NPkRrErC1u+1/VUKJnvKr5Oc9NNTFqCydPPFe c7fbPSV9rtp4PqhKXVRfA+2Jpk5InGU22CB3R7MBnugtBpfxCDvU1kieEt3KyNg+lBZQ I9hbpTEHeNh/MJt3bfSnLOASxfJJX7Vn5xTUdnf7od/lyHKySJcZ29hl5Uc1Sk7l55bm nOR811xcQjRdOrEK4ApXzxaI0utFEO6yrjBbtWq5NSaVxLEHYcWFZvpwfw+wCmn/T7Ii yjNw== X-Received: by 10.180.104.42 with SMTP id gb10mr2691979wib.65.1409307204607; Fri, 29 Aug 2014 03:13:24 -0700 (PDT) Received: from david-tp.localdomain (stgt-4d02e0c1.pool.mediaWays.net. [77.2.224.193]) by mx.google.com with ESMTPSA id la2sm17479347wjb.5.2014.08.29.03.13.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Aug 2014 03:13:23 -0700 (PDT) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH 04/20] drm: move "struct drm_magic_entry" to drm_auth.c Date: Fri, 29 Aug 2014 12:12:30 +0200 Message-Id: <1409307166-12396-5-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1409307166-12396-1-git-send-email-dh.herrmann@gmail.com> References: <1409307166-12396-1-git-send-email-dh.herrmann@gmail.com> Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 In drm_release(), we currently call drm_remove_magic() if the drm_file has a drm-magic attached. Therefore, once drm_master_release() is called, the magic-list _must_ be empty. By dropping the no-op cleanup, we can move "struct drm_magic_entry" to drm_auth.c and avoid exposing it to all of DRM. Signed-off-by: David Herrmann Reviewed-by: Thierry Reding --- drivers/gpu/drm/drm_auth.c | 6 ++++++ drivers/gpu/drm/drm_drv.c | 7 ------- include/drm/drmP.h | 6 ------ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c index 3cedae1..708a204 100644 --- a/drivers/gpu/drm/drm_auth.c +++ b/drivers/gpu/drm/drm_auth.c @@ -35,6 +35,12 @@ #include +struct drm_magic_entry { + struct list_head head; + struct drm_hash_item hash_item; + struct drm_file *priv; +}; + /** * Find the file with the given magic number. * diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index b1587e2..6645669 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -133,7 +133,6 @@ EXPORT_SYMBOL(drm_master_get); static void drm_master_destroy(struct kref *kref) { struct drm_master *master = container_of(kref, struct drm_master, refcount); - struct drm_magic_entry *pt, *next; struct drm_device *dev = master->minor->dev; struct drm_map_list *r_list, *list_temp; @@ -154,12 +153,6 @@ static void drm_master_destroy(struct kref *kref) master->unique_len = 0; } - list_for_each_entry_safe(pt, next, &master->magicfree, head) { - list_del(&pt->head); - drm_ht_remove_item(&master->magiclist, &pt->hash_item); - kfree(pt); - } - drm_ht_remove(&master->magiclist); mutex_unlock(&dev->struct_mutex); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 11c3575..0fdd813 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -290,12 +290,6 @@ struct drm_ioctl_desc { #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl} -struct drm_magic_entry { - struct list_head head; - struct drm_hash_item hash_item; - struct drm_file *priv; -}; - /** * DMA buffer. */