From patchwork Mon Dec 26 15:50:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13081882 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF3D4C4332F for ; Mon, 26 Dec 2022 15:51:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D3CBC10E036; Mon, 26 Dec 2022 15:51:47 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4933010E08D; Mon, 26 Dec 2022 15:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ovYu3O6J/03o6FRSeZBXYjTQnhI8+HeH3STrFxD4fqo=; b=q6Y2ynNG9Hqvk3GBR5TbozENdA tokY4kYGNRQTgj3V4qFoAAM0Ppk2hHnlSKALYuQ5z2Iro6G1Duy9yge28CQGvKOvrZeQaZ12v8THZ xgTLVC/7xEzYa1qJezouE+D1i0Z6FDi87WtRTBBf0q+ef7lMMm+VjnJ9vtMitt71c0uGaKo4fbfR9 7Cuuf+4vVqWjG1fcrS5Z0aCkpTyU1tHyeOvcy8kPJv1VPbz/STlgu1hNzAsiEWv+u/ZDxuP3JB9uC O7ZYeg72Q5ERXtbg+++geXfml80M+qLb0Z7O3dy0IqWet2W0WUyJzc7qzuX7zeH21QueeNP+5CmCH scFpab5g==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1p9plN-00AXBr-Hs; Mon, 26 Dec 2022 16:51:42 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/9] drm/etnaviv: use new debugfs device-centered functions Date: Mon, 26 Dec 2022 12:50:21 -0300 Message-Id: <20221226155029.244355-2-mcanal@igalia.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221226155029.244355-1-mcanal@igalia.com> References: <20221226155029.244355-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Andr=C3=A9_Almeida?= , Tomi Valkeinen , Emma Anholt , Alexey Brodkin , =?utf-8?q?Ma=C3=ADra_Canal?= , Liviu Dudau , etnaviv@lists.freedesktop.org, Gurchetan Singh , Melissa Wen , noralf@tronnes.org, Gerd Hoffmann , Russell King , David Airlie Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_create_files() with the new drm_debugfs_add_files() function, which center the debugfs files management on the drm_device instead of drm_minor. Moreover, remove the debugfs_init hook and add the debugfs files directly on etnaviv_bind(), before drm_dev_register(). Signed-off-by: MaĆ­ra Canal --- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 29 +++++++++++---------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c index 1d2b4fb4bcf8..2b265460672e 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -191,22 +191,22 @@ static int etnaviv_ring_show(struct etnaviv_gpu *gpu, struct seq_file *m) static int show_unlocked(struct seq_file *m, void *arg) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; int (*show)(struct drm_device *dev, struct seq_file *m) = - node->info_ent->data; + entry->file.data; return show(dev, m); } static int show_each_gpu(struct seq_file *m, void *arg) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; struct etnaviv_drm_private *priv = dev->dev_private; struct etnaviv_gpu *gpu; int (*show)(struct etnaviv_gpu *gpu, struct seq_file *m) = - node->info_ent->data; + entry->file.data; unsigned int i; int ret = 0; @@ -223,20 +223,13 @@ static int show_each_gpu(struct seq_file *m, void *arg) return ret; } -static struct drm_info_list etnaviv_debugfs_list[] = { +static struct drm_debugfs_info etnaviv_debugfs_list[] = { {"gpu", show_each_gpu, 0, etnaviv_gpu_debugfs}, {"gem", show_unlocked, 0, etnaviv_gem_show}, { "mm", show_unlocked, 0, etnaviv_mm_show }, {"mmu", show_each_gpu, 0, etnaviv_mmu_show}, {"ring", show_each_gpu, 0, etnaviv_ring_show}, }; - -static void etnaviv_debugfs_init(struct drm_minor *minor) -{ - drm_debugfs_create_files(etnaviv_debugfs_list, - ARRAY_SIZE(etnaviv_debugfs_list), - minor->debugfs_root, minor); -} #endif /* @@ -478,9 +471,6 @@ static const struct drm_driver etnaviv_drm_driver = { .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import_sg_table = etnaviv_gem_prime_import_sg_table, .gem_prime_mmap = drm_gem_prime_mmap, -#ifdef CONFIG_DEBUG_FS - .debugfs_init = etnaviv_debugfs_init, -#endif .ioctls = etnaviv_ioctls, .num_ioctls = DRM_ETNAVIV_NUM_IOCTLS, .fops = &fops, @@ -534,6 +524,11 @@ static int etnaviv_bind(struct device *dev) load_gpu(drm); +#ifdef CONFIG_DEBUG_FS + drm_debugfs_add_files(drm, etnaviv_debugfs_list, + ARRAY_SIZE(etnaviv_debugfs_list)); +#endif + ret = drm_dev_register(drm, 0); if (ret) goto out_unbind;