[v2] drm/msm/dpu: Use provided drm_minor to initialize debugfs

Submitted by Sean Paul on May 28, 2019, 3:13 p.m.

Details

Message ID 20190528151339.207978-1-sean@poorly.run
State New
Headers show
Series "Series without cover letter" ( rev: 2 ) in DRI devel

Not browsing as part of any series.

Commit Message

Sean Paul May 28, 2019, 3:13 p.m.
From: Sean Paul <seanpaul@chromium.org>

Instead of reaching into dev->primary for debugfs_root, use the minor
passed into debugfs_init.

This avoids creating a debug directory under /sys/kernel/debug/debug
and instead uses /sys/kernel/debug/dri/<node>/

Since we're now putting everything under */dri/<node>, there's no
need to create a duplicate "debug" directory. Just put everything in
the root.

Changes in v2:
- Remove the unnecessary "debug" directory (Stephen)

Link to v1: https://patchwork.freedesktop.org/patch/msgid/20190524173231.5040-1-sean@poorly.run

Cc: Rob Clark <robdclark@chromium.org>
Reported-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 885bf88afa3ec..ad094704610f9 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -231,18 +231,14 @@  void *dpu_debugfs_create_regset32(const char *name, umode_t mode,
 			regset, &dpu_fops_regset32);
 }
 
-static int _dpu_debugfs_init(struct dpu_kms *dpu_kms)
+static int _dpu_debugfs_init(struct dpu_kms *dpu_kms, struct drm_minor *minor)
 {
 	void *p = dpu_hw_util_get_log_mask_ptr();
-	struct dentry *entry;
+	struct dentry *entry = minor->debugfs_root;
 
 	if (!p)
 		return -EINVAL;
 
-	entry = debugfs_create_dir("debug", dpu_kms->dev->primary->debugfs_root);
-	if (IS_ERR_OR_NULL(entry))
-		return -ENODEV;
-
 	/* allow root to be NULL */
 	debugfs_create_x32(DPU_DEBUGFS_HWMASKNAME, 0600, entry, p);
 
@@ -581,7 +577,7 @@  static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
 #ifdef CONFIG_DEBUG_FS
 static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
 {
-	return _dpu_debugfs_init(to_dpu_kms(kms));
+	return _dpu_debugfs_init(to_dpu_kms(kms), minor);
 }
 #endif
 

Comments

On Tue, May 28, 2019 at 8:13 AM Sean Paul <sean@poorly.run> wrote:
>
> From: Sean Paul <seanpaul@chromium.org>
>
> Instead of reaching into dev->primary for debugfs_root, use the minor
> passed into debugfs_init.
>
> This avoids creating a debug directory under /sys/kernel/debug/debug
> and instead uses /sys/kernel/debug/dri/<node>/
>
> Since we're now putting everything under */dri/<node>, there's no
> need to create a duplicate "debug" directory. Just put everything in
> the root.
>
> Changes in v2:
> - Remove the unnecessary "debug" directory (Stephen)
>
> Link to v1: https://patchwork.freedesktop.org/patch/msgid/20190524173231.5040-1-sean@poorly.run
>
> Cc: Rob Clark <robdclark@chromium.org>
> Reported-by: Stephen Boyd <swboyd@chromium.org>
> Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

nice!

Reviewed-by: Rob Clark <robdclark@gmail.com>


> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 885bf88afa3ec..ad094704610f9 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -231,18 +231,14 @@ void *dpu_debugfs_create_regset32(const char *name, umode_t mode,
>                         regset, &dpu_fops_regset32);
>  }
>
> -static int _dpu_debugfs_init(struct dpu_kms *dpu_kms)
> +static int _dpu_debugfs_init(struct dpu_kms *dpu_kms, struct drm_minor *minor)
>  {
>         void *p = dpu_hw_util_get_log_mask_ptr();
> -       struct dentry *entry;
> +       struct dentry *entry = minor->debugfs_root;
>
>         if (!p)
>                 return -EINVAL;
>
> -       entry = debugfs_create_dir("debug", dpu_kms->dev->primary->debugfs_root);
> -       if (IS_ERR_OR_NULL(entry))
> -               return -ENODEV;
> -
>         /* allow root to be NULL */
>         debugfs_create_x32(DPU_DEBUGFS_HWMASKNAME, 0600, entry, p);
>
> @@ -581,7 +577,7 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
>  #ifdef CONFIG_DEBUG_FS
>  static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
>  {
> -       return _dpu_debugfs_init(to_dpu_kms(kms));
> +       return _dpu_debugfs_init(to_dpu_kms(kms), minor);
>  }
>  #endif
>
> --
> Sean Paul, Software Engineer, Google / Chromium OS
>
> _______________________________________________
> Freedreno mailing list
> Freedreno@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedreno
On Tue, May 28, 2019 at 11:13:39AM -0400, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> Instead of reaching into dev->primary for debugfs_root, use the minor
> passed into debugfs_init.
> 
> This avoids creating a debug directory under /sys/kernel/debug/debug
> and instead uses /sys/kernel/debug/dri/<node>/
> 
> Since we're now putting everything under */dri/<node>, there's no
> need to create a duplicate "debug" directory. Just put everything in
> the root.
> 
> Changes in v2:
> - Remove the unnecessary "debug" directory (Stephen)
> 
> Link to v1: https://patchwork.freedesktop.org/patch/msgid/20190524173231.5040-1-sean@poorly.run
> 
> Cc: Rob Clark <robdclark@chromium.org>
> Reported-by: Stephen Boyd <swboyd@chromium.org>
> Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 885bf88afa3ec..ad094704610f9 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -231,18 +231,14 @@ void *dpu_debugfs_create_regset32(const char *name, umode_t mode,
>  			regset, &dpu_fops_regset32);
>  }
>  
> -static int _dpu_debugfs_init(struct dpu_kms *dpu_kms)
> +static int _dpu_debugfs_init(struct dpu_kms *dpu_kms, struct drm_minor *minor)
>  {
>  	void *p = dpu_hw_util_get_log_mask_ptr();
> -	struct dentry *entry;
> +	struct dentry *entry = minor->debugfs_root;
>  
>  	if (!p)
>  		return -EINVAL;
>  
> -	entry = debugfs_create_dir("debug", dpu_kms->dev->primary->debugfs_root);
> -	if (IS_ERR_OR_NULL(entry))
> -		return -ENODEV;
> -
>  	/* allow root to be NULL */

Minor nit, this comment seems to be misplaced even more now than it was before.

>  	debugfs_create_x32(DPU_DEBUGFS_HWMASKNAME, 0600, entry, p);
>  
> @@ -581,7 +577,7 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
>  #ifdef CONFIG_DEBUG_FS
>  static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
>  {
> -	return _dpu_debugfs_init(to_dpu_kms(kms));
> +	return _dpu_debugfs_init(to_dpu_kms(kms), minor);
>  }
>  #endif
>  
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS