From patchwork Thu Jan 26 22:56:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Noralf_Tr=C3=B8nnes?= X-Patchwork-Id: 9540287 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F93F60429 for ; Thu, 26 Jan 2017 22:59:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6600A20649 for ; Thu, 26 Jan 2017 22:59:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A7B328305; Thu, 26 Jan 2017 22:59:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B516F27D29 for ; Thu, 26 Jan 2017 22:59:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 31E166EC75; Thu, 26 Jan 2017 22:59:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.domeneshop.no (smtp.domeneshop.no [IPv6:2a01:5b40:0:3005::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0C2066EC75 for ; Thu, 26 Jan 2017 22:59:33 +0000 (UTC) Received: from 211.81-166-168.customer.lyse.net ([81.166.168.211]:33677 helo=localhost.localdomain) by smtp.domeneshop.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cWsyB-0004r8-Vb; Thu, 26 Jan 2017 23:56:44 +0100 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 13/19] drm/sti: Remove drm_debugfs_remove_files() calls Date: Thu, 26 Jan 2017 23:56:15 +0100 Message-Id: <20170126225621.12314-14-noralf@tronnes.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170126225621.12314-1-noralf@tronnes.org> References: <20170126225621.12314-1-noralf@tronnes.org> MIME-Version: 1.0 Cc: kraxel@redhat.com, liviu.dudau@arm.com, linux@armlinux.org.uk, jsarha@ti.com, tomi.valkeinen@ti.com, bskeggs@redhat.com, linux+etnaviv@armlinux.org.uk, alexander.deucher@amd.com, daniel.vetter@intel.com, vincent.abriou@st.com, christian.koenig@amd.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP drm_debugfs_cleanup() now removes all minor->debugfs_list entries automatically, so it's not necessary to call drm_debugfs_remove_files(). Additionally it uses debugfs_remove_recursive() to clean up the debugfs files, so no need for adding fake drm_info_node entries. Cc: benjamin.gaignard@linaro.org Cc: vincent.abriou@st.com Signed-off-by: Noralf Trønnes Acked-by: Vincent Abriou Tested-by: Vincent Abriou --- drivers/gpu/drm/sti/sti_drv.c | 48 ++++++----------------------------------- drivers/gpu/drm/sti/sti_dvo.c | 10 --------- drivers/gpu/drm/sti/sti_hda.c | 11 ---------- drivers/gpu/drm/sti/sti_hdmi.c | 11 ---------- drivers/gpu/drm/sti/sti_tvout.c | 8 ------- 5 files changed, 6 insertions(+), 82 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index ff71e25..d3db224 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -89,38 +89,9 @@ static struct drm_info_list sti_drm_dbg_list[] = { {"fps_get", sti_drm_fps_dbg_show, 0}, }; -static int sti_drm_debugfs_create(struct dentry *root, - struct drm_minor *minor, - const char *name, - const struct file_operations *fops) -{ - struct drm_device *dev = minor->dev; - struct drm_info_node *node; - struct dentry *ent; - - ent = debugfs_create_file(name, S_IRUGO | S_IWUSR, root, dev, fops); - if (IS_ERR(ent)) - return PTR_ERR(ent); - - node = kmalloc(sizeof(*node), GFP_KERNEL); - if (!node) { - debugfs_remove(ent); - return -ENOMEM; - } - - node->minor = minor; - node->dent = ent; - node->info_ent = (void *)fops; - - mutex_lock(&minor->debugfs_lock); - list_add(&node->list, &minor->debugfs_list); - mutex_unlock(&minor->debugfs_lock); - - return 0; -} - static int sti_drm_dbg_init(struct drm_minor *minor) { + struct dentry *dentry; int ret; ret = drm_debugfs_create_files(sti_drm_dbg_list, @@ -129,10 +100,13 @@ static int sti_drm_dbg_init(struct drm_minor *minor) if (ret) goto err; - ret = sti_drm_debugfs_create(minor->debugfs_root, minor, "fps_show", + dentry = debugfs_create_file("fps_show", S_IRUGO | S_IWUSR, + minor->debugfs_root, minor->dev, &sti_drm_fps_fops); - if (ret) + if (!dentry) { + ret = -ENOMEM; goto err; + } DRM_INFO("%s: debugfs installed\n", DRIVER_NAME); return 0; @@ -141,15 +115,6 @@ static int sti_drm_dbg_init(struct drm_minor *minor) return ret; } -static void sti_drm_dbg_cleanup(struct drm_minor *minor) -{ - drm_debugfs_remove_files(sti_drm_dbg_list, - ARRAY_SIZE(sti_drm_dbg_list), minor); - - drm_debugfs_remove_files((struct drm_info_list *)&sti_drm_fps_fops, - 1, minor); -} - static void sti_atomic_schedule(struct sti_private *private, struct drm_atomic_state *state) { @@ -326,7 +291,6 @@ static struct drm_driver sti_driver = { .gem_prime_mmap = drm_gem_cma_prime_mmap, .debugfs_init = sti_drm_dbg_init, - .debugfs_cleanup = sti_drm_dbg_cleanup, .name = DRIVER_NAME, .desc = DRIVER_DESC, diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c index 411dc6e..bb23318 100644 --- a/drivers/gpu/drm/sti/sti_dvo.c +++ b/drivers/gpu/drm/sti/sti_dvo.c @@ -195,13 +195,6 @@ static struct drm_info_list dvo_debugfs_files[] = { { "dvo", dvo_dbg_show, 0, NULL }, }; -static void dvo_debugfs_exit(struct sti_dvo *dvo, struct drm_minor *minor) -{ - drm_debugfs_remove_files(dvo_debugfs_files, - ARRAY_SIZE(dvo_debugfs_files), - minor); -} - static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor) { unsigned int i; @@ -514,9 +507,6 @@ static void sti_dvo_unbind(struct device *dev, struct device *master, void *data) { struct sti_dvo *dvo = dev_get_drvdata(dev); - struct drm_device *drm_dev = data; - - dvo_debugfs_exit(dvo, drm_dev->primary); drm_bridge_remove(dvo->bridge); } diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c index 66d37d78..0c0a75b 100644 --- a/drivers/gpu/drm/sti/sti_hda.c +++ b/drivers/gpu/drm/sti/sti_hda.c @@ -365,13 +365,6 @@ static struct drm_info_list hda_debugfs_files[] = { { "hda", hda_dbg_show, 0, NULL }, }; -static void hda_debugfs_exit(struct sti_hda *hda, struct drm_minor *minor) -{ - drm_debugfs_remove_files(hda_debugfs_files, - ARRAY_SIZE(hda_debugfs_files), - minor); -} - static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor) { unsigned int i; @@ -739,10 +732,6 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data) static void sti_hda_unbind(struct device *dev, struct device *master, void *data) { - struct sti_hda *hda = dev_get_drvdata(dev); - struct drm_device *drm_dev = data; - - hda_debugfs_exit(hda, drm_dev->primary); } static const struct component_ops sti_hda_ops = { diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index f0af1ae..4a8bd62 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -731,13 +731,6 @@ static struct drm_info_list hdmi_debugfs_files[] = { { "hdmi", hdmi_dbg_show, 0, NULL }, }; -static void hdmi_debugfs_exit(struct sti_hdmi *hdmi, struct drm_minor *minor) -{ - drm_debugfs_remove_files(hdmi_debugfs_files, - ARRAY_SIZE(hdmi_debugfs_files), - minor); -} - static int hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor) { unsigned int i; @@ -1359,10 +1352,6 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) static void sti_hdmi_unbind(struct device *dev, struct device *master, void *data) { - struct sti_hdmi *hdmi = dev_get_drvdata(dev); - struct drm_device *drm_dev = data; - - hdmi_debugfs_exit(hdmi, drm_dev->primary); } static const struct component_ops sti_hdmi_ops = { diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c index ad46d35..8b8ea71 100644 --- a/drivers/gpu/drm/sti/sti_tvout.c +++ b/drivers/gpu/drm/sti/sti_tvout.c @@ -567,13 +567,6 @@ static struct drm_info_list tvout_debugfs_files[] = { { "tvout", tvout_dbg_show, 0, NULL }, }; -static void tvout_debugfs_exit(struct sti_tvout *tvout, struct drm_minor *minor) -{ - drm_debugfs_remove_files(tvout_debugfs_files, - ARRAY_SIZE(tvout_debugfs_files), - minor); -} - static int tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor) { unsigned int i; @@ -627,7 +620,6 @@ static void sti_tvout_early_unregister(struct drm_encoder *encoder) if (!tvout->debugfs_registered) return; - tvout_debugfs_exit(tvout, encoder->dev->primary); tvout->debugfs_registered = false; }