[PATCH 11/13] drm/sti: Use the encoders' debugfs infrastructure

Maíra Canal mcanal at igalia.com
Wed Jan 11 17:37:46 UTC 2023


Replace the use of drm_debugfs_add_files() with the new
drm_debugfs_encoder_add_files() function, which centers the debugfs files
management on the drm_encoder instead of drm_device. Using this function
on late register callbacks is more adequate as the callback passes a
drm_encoder as parameter.

Signed-off-by: Maíra Canal <mcanal at igalia.com>
---
 drivers/gpu/drm/sti/sti_tvout.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 2499715a69b7..5601888caec4 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -496,8 +496,8 @@ static void tvout_dbg_hd_dac_cfg(struct seq_file *s, int val)
 
 static int tvout_dbg_show(struct seq_file *s, void *data)
 {
-	struct drm_info_node *node = s->private;
-	struct sti_tvout *tvout = (struct sti_tvout *)node->info_ent->data;
+	struct drm_debugfs_encoder_entry *entry = s->private;
+	struct sti_tvout *tvout = (struct sti_tvout *)entry->file.data;
 	struct drm_crtc *crtc;
 
 	seq_printf(s, "TVOUT: (vaddr = 0x%p)", tvout->regs);
@@ -566,20 +566,9 @@ static int tvout_dbg_show(struct seq_file *s, void *data)
 	return 0;
 }
 
-static struct drm_info_list tvout_debugfs_files[] = {
-	{ "tvout", tvout_dbg_show, 0, NULL },
-};
-
-static void tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor)
+static void tvout_debugfs_init(struct sti_tvout *tvout, struct drm_encoder *encoder)
 {
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(tvout_debugfs_files); i++)
-		tvout_debugfs_files[i].data = tvout;
-
-	drm_debugfs_create_files(tvout_debugfs_files,
-				 ARRAY_SIZE(tvout_debugfs_files),
-				 minor->debugfs_root, minor);
+	drm_debugfs_encoder_add_file(encoder, "tvout", tvout_dbg_show, tvout);
 }
 
 static void sti_tvout_encoder_dpms(struct drm_encoder *encoder, int mode)
@@ -607,7 +596,7 @@ static int sti_tvout_late_register(struct drm_encoder *encoder)
 	if (tvout->debugfs_registered)
 		return 0;
 
-	tvout_debugfs_init(tvout, encoder->dev->primary);
+	tvout_debugfs_init(tvout, encoder);
 
 	tvout->debugfs_registered = true;
 	return 0;
-- 
2.39.0



More information about the dri-devel mailing list