[PATCH 10/13] drm/sti: Use the connectors' debugfs infrastructure

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


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

Signed-off-by: Maíra Canal <mcanal at igalia.com>
---
 drivers/gpu/drm/sti/sti_dvo.c  | 21 +++++----------------
 drivers/gpu/drm/sti/sti_hda.c  | 21 +++++----------------
 drivers/gpu/drm/sti/sti_hdmi.c | 21 +++++----------------
 3 files changed, 15 insertions(+), 48 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index f3a5616b7daf..b617c288b893 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -178,8 +178,8 @@ static void dvo_dbg_awg_microcode(struct seq_file *s, void __iomem *reg)
 
 static int dvo_dbg_show(struct seq_file *s, void *data)
 {
-	struct drm_info_node *node = s->private;
-	struct sti_dvo *dvo = (struct sti_dvo *)node->info_ent->data;
+	struct drm_debugfs_connector_entry *entry = s->private;
+	struct sti_dvo *dvo = (struct sti_dvo *)entry->file.data;
 
 	seq_printf(s, "DVO: (vaddr = 0x%p)", dvo->regs);
 	DBGFS_DUMP(DVO_AWG_DIGSYNC_CTRL);
@@ -192,20 +192,9 @@ static int dvo_dbg_show(struct seq_file *s, void *data)
 	return 0;
 }
 
-static struct drm_info_list dvo_debugfs_files[] = {
-	{ "dvo", dvo_dbg_show, 0, NULL },
-};
-
-static void dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
+static void dvo_debugfs_init(struct sti_dvo *dvo, struct drm_connector *connector)
 {
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(dvo_debugfs_files); i++)
-		dvo_debugfs_files[i].data = dvo;
-
-	drm_debugfs_create_files(dvo_debugfs_files,
-				 ARRAY_SIZE(dvo_debugfs_files),
-				 minor->debugfs_root, minor);
+	drm_debugfs_connector_add_file(connector, "dvo", dvo_dbg_show, dvo);
 }
 
 static void sti_dvo_disable(struct drm_bridge *bridge)
@@ -403,7 +392,7 @@ static int sti_dvo_late_register(struct drm_connector *connector)
 		= to_sti_dvo_connector(connector);
 	struct sti_dvo *dvo = dvo_connector->dvo;
 
-	dvo_debugfs_init(dvo, dvo->drm_dev->primary);
+	dvo_debugfs_init(dvo, connector);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index ec6656b9ee7c..9560f29db6e1 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -345,8 +345,8 @@ static void hda_dbg_video_dacs_ctrl(struct seq_file *s, void __iomem *reg)
 
 static int hda_dbg_show(struct seq_file *s, void *data)
 {
-	struct drm_info_node *node = s->private;
-	struct sti_hda *hda = (struct sti_hda *)node->info_ent->data;
+	struct drm_debugfs_connector_entry *entry = s->private;
+	struct sti_hda *hda = (struct sti_hda *)entry->file.data;
 
 	seq_printf(s, "HD Analog: (vaddr = 0x%p)", hda->regs);
 	DBGFS_DUMP(HDA_ANA_CFG);
@@ -364,20 +364,9 @@ static int hda_dbg_show(struct seq_file *s, void *data)
 	return 0;
 }
 
-static struct drm_info_list hda_debugfs_files[] = {
-	{ "hda", hda_dbg_show, 0, NULL },
-};
-
-static void hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor)
+static void hda_debugfs_init(struct sti_hda *hda, struct drm_connector *connector)
 {
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(hda_debugfs_files); i++)
-		hda_debugfs_files[i].data = hda;
-
-	drm_debugfs_create_files(hda_debugfs_files,
-				 ARRAY_SIZE(hda_debugfs_files),
-				 minor->debugfs_root, minor);
+	drm_debugfs_connector_add_file(connector, "hda", hda_dbg_show, hda);
 }
 
 /**
@@ -643,7 +632,7 @@ static int sti_hda_late_register(struct drm_connector *connector)
 		= to_sti_hda_connector(connector);
 	struct sti_hda *hda = hda_connector->hda;
 
-	hda_debugfs_init(hda, hda->drm_dev->primary);
+	hda_debugfs_init(hda, connector);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index fcc2194869d6..9b82d9b7db6a 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -668,8 +668,8 @@ static void hdmi_dbg_sw_di_cfg(struct seq_file *s, int val)
 
 static int hdmi_dbg_show(struct seq_file *s, void *data)
 {
-	struct drm_info_node *node = s->private;
-	struct sti_hdmi *hdmi = (struct sti_hdmi *)node->info_ent->data;
+	struct drm_debugfs_connector_entry *entry = s->private;
+	struct sti_hdmi *hdmi = (struct sti_hdmi *)entry->file.data;
 
 	seq_printf(s, "HDMI: (vaddr = 0x%p)", hdmi->regs);
 	DBGFS_DUMP("\n", HDMI_CFG);
@@ -730,20 +730,9 @@ static int hdmi_dbg_show(struct seq_file *s, void *data)
 	return 0;
 }
 
-static struct drm_info_list hdmi_debugfs_files[] = {
-	{ "hdmi", hdmi_dbg_show, 0, NULL },
-};
-
-static void hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor)
+static void hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_connector *connector)
 {
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(hdmi_debugfs_files); i++)
-		hdmi_debugfs_files[i].data = hdmi;
-
-	drm_debugfs_create_files(hdmi_debugfs_files,
-				 ARRAY_SIZE(hdmi_debugfs_files),
-				 minor->debugfs_root, minor);
+	drm_debugfs_connector_add_file(connector, "hdmi", hdmi_dbg_show, hdmi);
 }
 
 static void sti_hdmi_disable(struct drm_bridge *bridge)
@@ -1120,7 +1109,7 @@ static int sti_hdmi_late_register(struct drm_connector *connector)
 		= to_sti_hdmi_connector(connector);
 	struct sti_hdmi *hdmi = hdmi_connector->hdmi;
 
-	hdmi_debugfs_init(hdmi, hdmi->drm_dev->primary);
+	hdmi_debugfs_init(hdmi, connector);
 
 	return 0;
 }
-- 
2.39.0



More information about the dri-devel mailing list