On 3/20/2023 6:18 PM, Dmitry Baryshkov wrote:
As the debugfs is fully cleared on drm device removal, drop the
encoder-specific cleanup function, remove debugfs_root from dpu_encoder
struct and also remove phys_encoder late_register() ops which has been
unused since the driver being added.


Agreed, late_register of encoder_phys is unused, so we can drop that.

For the other two things which this patch does:

1) remove debugfs_root from dpu_encoder
2) remove early_unregister of dpu_encoder

I think this has been posted separately here https://patchwork.freedesktop.org/patch/534802/?series=117150&rev=1 for which I had given my feedback about why it cant be removed

So these 2 parts have to be kept till we sort out that feedback

Signed-off-by: Dmitry Baryshkov <dmitry.barysh...@linaro.org>
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c   | 22 +++----------------
  .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h  |  3 ---
  2 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 97d8d777f178..28729c77364f 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -142,7 +142,6 @@ enum dpu_enc_rc_states {
   * @crtc_kickoff_cb:          Callback into CRTC that will flush & start
   *                            all CTL paths
   * @crtc_kickoff_cb_data:     Opaque user data given to crtc_kickoff_cb
- * @debugfs_root:              Debug file system root file node
   * @enc_lock:                 Lock around physical encoder
   *                            create/destroy/enable/disable
   * @frame_busy_mask:          Bitmask tracking which phys_enc we are still
@@ -186,7 +185,6 @@ struct dpu_encoder_virt {
        struct drm_crtc *crtc;
        struct drm_connector *connector;
- struct dentry *debugfs_root;
        struct mutex enc_lock;
        DECLARE_BITMAP(frame_busy_mask, MAX_PHYS_ENCODERS_PER_VIRTUAL);
        void (*crtc_frame_event_cb)(void *, u32 event);
@@ -2134,7 +2132,7 @@ DEFINE_SHOW_ATTRIBUTE(_dpu_encoder_status);
  static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc)
  {
        struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
-       int i;
+       struct dentry *debugfs_root;
char name[DPU_NAME_SIZE]; @@ -2146,18 +2144,12 @@ static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc)
        snprintf(name, DPU_NAME_SIZE, "encoder%u", drm_enc->base.id);
/* create overall sub-directory for the encoder */
-       dpu_enc->debugfs_root = debugfs_create_dir(name,
+       debugfs_root = debugfs_create_dir(name,
                        drm_enc->dev->primary->debugfs_root);
/* don't error check these */
        debugfs_create_file("status", 0600,
-               dpu_enc->debugfs_root, dpu_enc, &_dpu_encoder_status_fops);
-
-       for (i = 0; i < dpu_enc->num_phys_encs; i++)
-               if (dpu_enc->phys_encs[i]->ops.late_register)
-                       dpu_enc->phys_encs[i]->ops.late_register(
-                                       dpu_enc->phys_encs[i],
-                                       dpu_enc->debugfs_root);
+               debugfs_root, dpu_enc, &_dpu_encoder_status_fops);
return 0;
  }
@@ -2173,13 +2165,6 @@ static int dpu_encoder_late_register(struct drm_encoder 
*encoder)
        return _dpu_encoder_init_debugfs(encoder);
  }
-static void dpu_encoder_early_unregister(struct drm_encoder *encoder)
-{
-       struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(encoder);
-
-       debugfs_remove_recursive(dpu_enc->debugfs_root);
-}
-
  static int dpu_encoder_virt_add_phys_encs(
                struct msm_display_info *disp_info,
                struct dpu_encoder_virt *dpu_enc,
@@ -2406,7 +2391,6 @@ static const struct drm_encoder_helper_funcs 
dpu_encoder_helper_funcs = {
  static const struct drm_encoder_funcs dpu_encoder_funcs = {
                .destroy = dpu_encoder_destroy,
                .late_register = dpu_encoder_late_register,
-               .early_unregister = dpu_encoder_early_unregister,
  };
int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc,
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
index 1d434b22180d..9e29079a6fc4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
@@ -63,7 +63,6 @@ struct dpu_encoder_phys;
  /**
   * struct dpu_encoder_phys_ops - Interface the physical encoders provide to
   *    the containing virtual encoder.
- * @late_register:             DRM Call. Add Userspace interfaces, debugfs.
   * @prepare_commit:           MSM Atomic Call, start of atomic commit sequence
   * @is_master:                        Whether this phys_enc is the current 
master
   *                            encoder. Can be switched at enable time. Based
@@ -93,8 +92,6 @@ struct dpu_encoder_phys;
   */
struct dpu_encoder_phys_ops {
-       int (*late_register)(struct dpu_encoder_phys *encoder,
-                       struct dentry *debugfs_root);
        void (*prepare_commit)(struct dpu_encoder_phys *encoder);
        bool (*is_master)(struct dpu_encoder_phys *encoder);
        void (*atomic_mode_set)(struct dpu_encoder_phys *encoder,

Reply via email to