diff mbox series

[06/13] drm/vc4: Split variable instantiation of vc4_debugfs_regset32()

Message ID 20230111173748.752659-7-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series drm/debugfs: Create a debugfs infrastructure for kms objects | expand

Commit Message

Maíra Canal Jan. 11, 2023, 5:37 p.m. UTC
Considering that there are multiple ways to instantiate a
drm_debugfs_entry, as kms object's debugfs entries were introduced,
split vc4_debugfs_regset32() into two functions: one to deal with the
drm_printer and the other to instantiate the proper variables.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 drivers/gpu/drm/vc4/vc4_debugfs.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c
index fac624a663ea..80afc69200f0 100644
--- a/drivers/gpu/drm/vc4/vc4_debugfs.c
+++ b/drivers/gpu/drm/vc4/vc4_debugfs.c
@@ -32,27 +32,34 @@  vc4_debugfs_init(struct drm_minor *minor)
 	}
 }
 
-static int vc4_debugfs_regset32(struct seq_file *m, void *unused)
+static int vc4_debugfs_regset32(struct drm_device *drm, struct debugfs_regset32 *regset,
+				struct drm_printer *p)
 {
-	struct drm_debugfs_entry *entry = m->private;
-	struct drm_device *drm = entry->dev;
-	struct debugfs_regset32 *regset = entry->file.data;
-	struct drm_printer p = drm_seq_file_printer(m);
 	int idx;
 
 	if (!drm_dev_enter(drm, &idx))
 		return -ENODEV;
 
-	drm_print_regset32(&p, regset);
+	drm_print_regset32(p, regset);
 
 	drm_dev_exit(idx);
 
 	return 0;
 }
 
+static int vc4_debugfs_dev_regset32(struct seq_file *m, void *unused)
+{
+	struct drm_debugfs_entry *entry = m->private;
+	struct drm_device *drm = entry->dev;
+	struct debugfs_regset32 *regset = entry->file.data;
+	struct drm_printer p = drm_seq_file_printer(m);
+
+	return vc4_debugfs_regset32(drm, regset, &p);
+}
+
 void vc4_debugfs_add_regset32(struct drm_device *drm,
 			      const char *name,
 			      struct debugfs_regset32 *regset)
 {
-	drm_debugfs_add_file(drm, name, vc4_debugfs_regset32, regset);
+	drm_debugfs_add_file(drm, name, vc4_debugfs_dev_regset32, regset);
 }