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

Signed-off-by: Maíra Canal <mca...@igalia.com>
---
 drivers/gpu/drm/vc4/vc4_crtc.c    |  5 ++---
 drivers/gpu/drm/vc4/vc4_debugfs.c | 17 +++++++++++++++++
 drivers/gpu/drm/vc4/vc4_drv.h     |  8 ++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index cdc0559221f0..3e5c71c0bed3 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -1104,12 +1104,11 @@ void vc4_crtc_reset(struct drm_crtc *crtc)
 
 int vc4_crtc_late_register(struct drm_crtc *crtc)
 {
-       struct drm_device *drm = crtc->dev;
        struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
        const struct vc4_crtc_data *crtc_data = 
vc4_crtc_to_vc4_crtc_data(vc4_crtc);
 
-       vc4_debugfs_add_regset32(drm, crtc_data->debugfs_name,
-                                &vc4_crtc->regset);
+       vc4_debugfs_crtc_add_regset32(crtc, crtc_data->debugfs_name,
+                                     &vc4_crtc->regset);
 
        return 0;
 }
diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c 
b/drivers/gpu/drm/vc4/vc4_debugfs.c
index c71e4d6ec4c4..33023ae32ddf 100644
--- a/drivers/gpu/drm/vc4/vc4_debugfs.c
+++ b/drivers/gpu/drm/vc4/vc4_debugfs.c
@@ -57,6 +57,16 @@ static int vc4_debugfs_dev_regset32(struct seq_file *m, void 
*unused)
        return vc4_debugfs_regset32(drm, regset, &p);
 }
 
+static int vc4_debugfs_crtc_regset32(struct seq_file *m, void *unused)
+{
+       struct drm_debugfs_crtc_entry *entry = m->private;
+       struct drm_device *drm = entry->crtc->dev;
+       struct debugfs_regset32 *regset = entry->file.data;
+       struct drm_printer p = drm_seq_file_printer(m);
+
+       return vc4_debugfs_regset32(drm, regset, &p);
+}
+
 static int vc4_debugfs_encoder_regset32(struct seq_file *m, void *unused)
 {
        struct drm_debugfs_encoder_entry *entry = m->private;
@@ -74,6 +84,13 @@ void vc4_debugfs_add_regset32(struct drm_device *drm,
        drm_debugfs_add_file(drm, name, vc4_debugfs_dev_regset32, regset);
 }
 
+void vc4_debugfs_crtc_add_regset32(struct drm_crtc *crtc,
+                                  const char *name,
+                                  struct debugfs_regset32 *regset)
+{
+       drm_debugfs_crtc_add_file(crtc, name, vc4_debugfs_crtc_regset32, 
regset);
+}
+
 void vc4_debugfs_encoder_add_regset32(struct drm_encoder *encoder,
                                      const char *name,
                                      struct debugfs_regset32 *regset)
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 8aaa8d00bc45..9a1b777afee2 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -969,6 +969,9 @@ void vc4_debugfs_init(struct drm_minor *minor);
 void vc4_debugfs_add_regset32(struct drm_device *drm,
                              const char *filename,
                              struct debugfs_regset32 *regset);
+void vc4_debugfs_crtc_add_regset32(struct drm_crtc *crtc,
+                                  const char *name,
+                                  struct debugfs_regset32 *regset);
 void vc4_debugfs_encoder_add_regset32(struct drm_encoder *encoder,
                                      const char *name,
                                      struct debugfs_regset32 *regset);
@@ -979,6 +982,11 @@ static inline void vc4_debugfs_add_regset32(struct 
drm_device *drm,
                                            struct debugfs_regset32 *regset)
 {}
 
+static inline void vc4_debugfs_crtc_add_regset32(struct drm_crtc *crtc,
+                                                const char *name,
+                                                struct debugfs_regset32 
*regset)
+{}
+
 static inline void vc4_debugfs_encoder_add_regset32(struct drm_encoder 
*encoder,
                                                    const char *name,
                                                    struct debugfs_regset32 
*regset)
-- 
2.39.0

Reply via email to