diff mbox series

[v2,2/7] drm/pl111: use new debugfs device-centered functions

Message ID 20230109115520.40088-3-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series Convert drivers to the new debugfs device-centered functions | expand

Commit Message

Maíra Canal Jan. 9, 2023, 11:55 a.m. UTC
Replace the use of drm_debugfs_create_files() with the new
drm_debugfs_add_file() function, which centers 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 pl111_amba_probe(),
before drm_dev_register().

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 drivers/gpu/drm/pl111/Makefile        |  4 ++--
 drivers/gpu/drm/pl111/pl111_debugfs.c | 17 +++++------------
 drivers/gpu/drm/pl111/pl111_drm.h     |  2 +-
 drivers/gpu/drm/pl111/pl111_drv.c     |  6 ++----
 4 files changed, 10 insertions(+), 19 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/pl111/Makefile b/drivers/gpu/drm/pl111/Makefile
index 67d430d433e0..8e4d53fdf314 100644
--- a/drivers/gpu/drm/pl111/Makefile
+++ b/drivers/gpu/drm/pl111/Makefile
@@ -1,9 +1,9 @@ 
 # SPDX-License-Identifier: GPL-2.0
 pl111_drm-y +=	pl111_display.o \
 		pl111_versatile.o \
-		pl111_drv.o
+		pl111_drv.o \
+		pl111_debugfs.o
 
 pl111_drm-$(CONFIG_ARCH_NOMADIK) += pl111_nomadik.o
-pl111_drm-$(CONFIG_DEBUG_FS) += pl111_debugfs.o
 
 obj-$(CONFIG_DRM_PL111) += pl111_drm.o
diff --git a/drivers/gpu/drm/pl111/pl111_debugfs.c b/drivers/gpu/drm/pl111/pl111_debugfs.c
index 6744fa16f464..d7cda31ceb2a 100644
--- a/drivers/gpu/drm/pl111/pl111_debugfs.c
+++ b/drivers/gpu/drm/pl111/pl111_debugfs.c
@@ -30,10 +30,10 @@  static const struct {
 	REGDEF(CLCD_PL111_LCUR),
 };
 
-static int pl111_debugfs_regs(struct seq_file *m, void *unused)
+static int __maybe_unused pl111_debugfs_regs(struct seq_file *m, void *unused)
 {
-	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 pl111_drm_dev_private *priv = dev->dev_private;
 	int i;
 
@@ -46,14 +46,7 @@  static int pl111_debugfs_regs(struct seq_file *m, void *unused)
 	return 0;
 }
 
-static const struct drm_info_list pl111_debugfs_list[] = {
-	{"regs", pl111_debugfs_regs, 0},
-};
-
-void
-pl111_debugfs_init(struct drm_minor *minor)
+void pl111_debugfs_init(struct drm_device *drm)
 {
-	drm_debugfs_create_files(pl111_debugfs_list,
-				 ARRAY_SIZE(pl111_debugfs_list),
-				 minor->debugfs_root, minor);
+	drm_debugfs_add_file(drm, "regs", pl111_debugfs_regs, NULL);
 }
diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h
index 2a46b5bd8576..7fe74be917f1 100644
--- a/drivers/gpu/drm/pl111/pl111_drm.h
+++ b/drivers/gpu/drm/pl111/pl111_drm.h
@@ -157,6 +157,6 @@  struct pl111_drm_dev_private {
 
 int pl111_display_init(struct drm_device *dev);
 irqreturn_t pl111_irq(int irq, void *data);
-void pl111_debugfs_init(struct drm_minor *minor);
+void pl111_debugfs_init(struct drm_device *drm);
 
 #endif /* _PL111_DRM_H_ */
diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c
index 00deba0b7271..c031eb4abc0d 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -228,10 +228,6 @@  static const struct drm_driver pl111_drm_driver = {
 	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 	.gem_prime_import_sg_table = pl111_gem_import_sg_table,
 	.gem_prime_mmap = drm_gem_prime_mmap,
-
-#if defined(CONFIG_DEBUG_FS)
-	.debugfs_init = pl111_debugfs_init,
-#endif
 };
 
 static int pl111_amba_probe(struct amba_device *amba_dev,
@@ -304,6 +300,8 @@  static int pl111_amba_probe(struct amba_device *amba_dev,
 	if (ret != 0)
 		goto dev_put;
 
+	pl111_debugfs_init(drm);
+
 	ret = drm_dev_register(drm, 0);
 	if (ret < 0)
 		goto dev_put;