From patchwork Tue Nov 22 19:03:10 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: 24516 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2391406wrr; Tue, 22 Nov 2022 11:07:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf4lHx9eRdxf/suqQYJY2yr+XiwyHdDd3vhSG5tj6mN84R3nm2vijDl8l6lRhWav9Hzli0oP X-Received: by 2002:a63:4a44:0:b0:476:837b:d4c4 with SMTP id j4-20020a634a44000000b00476837bd4c4mr22886109pgl.524.1669144058945; Tue, 22 Nov 2022 11:07:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669144058; cv=none; d=google.com; s=arc-20160816; b=oyq9sIml+0f7Jv43W5qas4bYeSiSYzwyQ8oZjV4i7W+Vge+mPsg+gakEveu2BdjMF7 QCu7WGCaNjBetMNo7MFJaWTlRbG22PdkR9cdXc6S9GPASyyJx6tm4KTJGQzaa8/qRk56 865iA0pW20okM3lW5Q+c2hcWR5ZZSDmNI23Wsq1BtODrn/zQlYTOqEEU5xWjG6Hu8h7U iDC4o6Zzxh3jz1C2L0ZeXvmIkI45kK/ele4UV47KxnLznXSVzQ6z1ME2znuC1scofjDc Qe+Su3wi66u+EcepvNU+VahQccVGAGFwdkE85o1Jmq1zy6ftLppKpAV4jwPt5I4s6dy9 1h+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=B63H70OP84tRUjEx6gv/fqRSzwu76nMaa1xXHe5fJyI=; b=xgMbTzpP/J6Giy/aMdYGmeSbY0P8R9AFRm02mnaHVmpriE8sHjnt/0ZrWYLlk6m7aG QkHyKQOH9Lg1NaW9mstl9lOX/tQhM/VUb6uQol5iZSBIhj0EDqcwjlMqcxFy6xNUw6C9 g1Pnv3t1B5DGLzwPvOQFaK0+ZKxoh5EPjLGUS9yBAxuqtGPUqS9eNyAR6lc5Ibgx7Tzt 6TKE37z5xbPPbvhsz1H3j8whsv4CVI4OEi+2MwDgp3JbtdF8EKK8oCSZ1IAsNMWptteS 97ewYfyAvoCA7JdURtgHNG/nazsTXduVLQHXh43lwyIsByV6WWoNNAXL7gaKXoxjgD8g SMdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=VeoQkwUY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a636c08000000b0046f0b3f7dbesi14801359pgc.408.2022.11.22.11.07.25; Tue, 22 Nov 2022 11:07:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=VeoQkwUY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234465AbiKVTFJ (ORCPT + 99 others); Tue, 22 Nov 2022 14:05:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234476AbiKVTFA (ORCPT ); Tue, 22 Nov 2022 14:05:00 -0500 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8DF886FDE for ; Tue, 22 Nov 2022 11:04:59 -0800 (PST) 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=B63H70OP84tRUjEx6gv/fqRSzwu76nMaa1xXHe5fJyI=; b=VeoQkwUY4PLz7Sf8oEfaIviPWj pUMKetzlsJXoljrUD8QTe00yrk5wD5fI0Bm71m/d6R2Cai+0lZn7C4WXkzMJQSyrZWREclLuz/aqp 8Z290ys+O7yC3LW+hxV1JoSsVYlQEDdJxmGU9xjn0nJLMU3wVTVP3fErazwV/G9H6MGMRRGP323PH pgP83lL1YZlB+/Uwwy5l8CUGS2SKPL8CyUGn3hfFWaL7U1GFXugPyUv1z4oVBkHKrqm8erpWH3puJ pld2RRO8vUa/1gdWpVEL1HYvd08ShzxYOqAwMxTGPoXivYkWX4L481pNp+oZlgMXykguKnmbtDzPA nb5yBNNw==; Received: from [177.34.169.227] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1oxYZc-007AP3-JZ; Tue, 22 Nov 2022 20:04:49 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Oded Gabbay Cc: Melissa Wen , =?utf-8?q?Andr=C3=A9_Almeida?= , Emma Anholt , Rodrigo Siqueira , Wambui Karuga , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?utf-8?q?Ma=C3=ADra_Canal?= Subject: [PATCH 2/6] drm: use new debugfs device-centered functions on DRM core files Date: Tue, 22 Nov 2022 16:03:10 -0300 Message-Id: <20221122190314.185015-3-mcanal@igalia.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221122190314.185015-1-mcanal@igalia.com> References: <20221122190314.185015-1-mcanal@igalia.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750224400927156349?= X-GMAIL-MSGID: =?utf-8?q?1750224400927156349?= Replace the use of drm_debugfs_create_files() with the new drm_debugfs_add_files() function in all DRM core files, centering the debugfs files management on the drm_device instead of drm_minor. Signed-off-by: MaĆ­ra Canal --- drivers/gpu/drm/drm_atomic.c | 11 +++++------ drivers/gpu/drm/drm_client.c | 11 +++++------ drivers/gpu/drm/drm_debugfs.c | 18 ++++++++---------- drivers/gpu/drm/drm_framebuffer.c | 11 +++++------ drivers/gpu/drm/drm_gem_vram_helper.c | 11 +++++------ 5 files changed, 28 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index f197f59f6d99..c7f23cf2552c 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1756,8 +1756,8 @@ EXPORT_SYMBOL(drm_state_dump); #ifdef CONFIG_DEBUG_FS static int drm_state_info(struct seq_file *m, void *data) { - 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 drm_printer p = drm_seq_file_printer(m); __drm_state_dump(dev, &p, true); @@ -1766,14 +1766,13 @@ static int drm_state_info(struct seq_file *m, void *data) } /* any use in debugfs files to dump individual planes/crtc/etc? */ -static const struct drm_info_list drm_atomic_debugfs_list[] = { +static const struct drm_debugfs_info drm_atomic_debugfs_list[] = { {"state", drm_state_info, 0}, }; void drm_atomic_debugfs_init(struct drm_minor *minor) { - drm_debugfs_create_files(drm_atomic_debugfs_list, - ARRAY_SIZE(drm_atomic_debugfs_list), - minor->debugfs_root, minor); + drm_debugfs_add_files(minor->dev, drm_atomic_debugfs_list, + ARRAY_SIZE(drm_atomic_debugfs_list)); } #endif diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c index fd67efe37c63..262ec64d4397 100644 --- a/drivers/gpu/drm/drm_client.c +++ b/drivers/gpu/drm/drm_client.c @@ -480,8 +480,8 @@ EXPORT_SYMBOL(drm_client_framebuffer_flush); #ifdef CONFIG_DEBUG_FS static int drm_client_debugfs_internal_clients(struct seq_file *m, void *data) { - struct drm_info_node *node = m->private; - struct drm_device *dev = node->minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; struct drm_printer p = drm_seq_file_printer(m); struct drm_client_dev *client; @@ -493,14 +493,13 @@ static int drm_client_debugfs_internal_clients(struct seq_file *m, void *data) return 0; } -static const struct drm_info_list drm_client_debugfs_list[] = { +static const struct drm_debugfs_info drm_client_debugfs_list[] = { { "internal_clients", drm_client_debugfs_internal_clients, 0 }, }; void drm_client_debugfs_init(struct drm_minor *minor) { - drm_debugfs_create_files(drm_client_debugfs_list, - ARRAY_SIZE(drm_client_debugfs_list), - minor->debugfs_root, minor); + drm_debugfs_add_files(minor->dev, drm_client_debugfs_list, + ARRAY_SIZE(drm_client_debugfs_list)); } #endif diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index ca27c2b05051..83f7530e7b46 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -51,9 +51,8 @@ static int drm_name_info(struct seq_file *m, void *data) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_minor *minor = node->minor; - struct drm_device *dev = minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; struct drm_master *master; mutex_lock(&dev->master_mutex); @@ -73,8 +72,8 @@ static int drm_name_info(struct seq_file *m, void *data) static int drm_clients_info(struct seq_file *m, void *data) { - 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 drm_file *priv; kuid_t uid; @@ -125,8 +124,8 @@ static int drm_gem_one_name_info(int id, void *ptr, void *data) static int drm_gem_name_info(struct seq_file *m, void *data) { - 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; seq_printf(m, " name size handles refcount\n"); @@ -137,7 +136,7 @@ static int drm_gem_name_info(struct seq_file *m, void *data) return 0; } -static const struct drm_info_list drm_debugfs_list[] = { +static const struct drm_debugfs_info drm_debugfs_list[] = { {"name", drm_name_info, 0}, {"clients", drm_clients_info, 0}, {"gem_names", drm_gem_name_info, DRIVER_GEM}, @@ -231,8 +230,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, sprintf(name, "%d", minor_id); minor->debugfs_root = debugfs_create_dir(name, root); - drm_debugfs_create_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, - minor->debugfs_root, minor); + drm_debugfs_add_files(minor->dev, drm_debugfs_list, DRM_DEBUGFS_ENTRIES); if (drm_drv_uses_atomic_modeset(dev)) { drm_atomic_debugfs_init(minor); diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 2dd97473ca10..aff3746dedfb 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -1203,8 +1203,8 @@ void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, #ifdef CONFIG_DEBUG_FS static int drm_framebuffer_info(struct seq_file *m, void *data) { - struct drm_info_node *node = m->private; - struct drm_device *dev = node->minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; struct drm_printer p = drm_seq_file_printer(m); struct drm_framebuffer *fb; @@ -1218,14 +1218,13 @@ static int drm_framebuffer_info(struct seq_file *m, void *data) return 0; } -static const struct drm_info_list drm_framebuffer_debugfs_list[] = { +static const struct drm_debugfs_info drm_framebuffer_debugfs_list[] = { { "framebuffer", drm_framebuffer_info, 0 }, }; void drm_framebuffer_debugfs_init(struct drm_minor *minor) { - drm_debugfs_create_files(drm_framebuffer_debugfs_list, - ARRAY_SIZE(drm_framebuffer_debugfs_list), - minor->debugfs_root, minor); + drm_debugfs_add_files(minor->dev, drm_framebuffer_debugfs_list, + ARRAY_SIZE(drm_framebuffer_debugfs_list)); } #endif diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c index b6c7e3803bb3..c06368dcacb2 100644 --- a/drivers/gpu/drm/drm_gem_vram_helper.c +++ b/drivers/gpu/drm/drm_gem_vram_helper.c @@ -956,8 +956,8 @@ static struct ttm_device_funcs bo_driver = { static int drm_vram_mm_debugfs(struct seq_file *m, void *data) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_vram_mm *vmm = node->minor->dev->vram_mm; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; struct ttm_resource_manager *man = ttm_manager_type(&vmm->bdev, TTM_PL_VRAM); struct drm_printer p = drm_seq_file_printer(m); @@ -965,7 +965,7 @@ static int drm_vram_mm_debugfs(struct seq_file *m, void *data) return 0; } -static const struct drm_info_list drm_vram_mm_debugfs_list[] = { +static const struct drm_debugfs_info drm_vram_mm_debugfs_list[] = { { "vram-mm", drm_vram_mm_debugfs, 0, NULL }, }; @@ -977,9 +977,8 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = { */ void drm_vram_mm_debugfs_init(struct drm_minor *minor) { - drm_debugfs_create_files(drm_vram_mm_debugfs_list, - ARRAY_SIZE(drm_vram_mm_debugfs_list), - minor->debugfs_root, minor); + drm_debugfs_add_files(minor->dev, drm_vram_mm_debugfs_list, + ARRAY_SIZE(drm_vram_mm_debugfs_list)); } EXPORT_SYMBOL(drm_vram_mm_debugfs_init);