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

Submitted by Sean Paul on May 24, 2019, 5:32 p.m.

Details

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

Not browsing as part of any series.

Commit Message

Sean Paul May 24, 2019, 5:32 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 the debug directory under /sys/kernel/debug/ and
instead creates the directory under the correct node in
/sys/kernel/debug/dri/<node>/

Reported-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +++---
 1 file changed, 3 insertions(+), 3 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 885bf88afa3e..d77071965431 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -231,7 +231,7 @@  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;
@@ -239,7 +239,7 @@  static int _dpu_debugfs_init(struct dpu_kms *dpu_kms)
 	if (!p)
 		return -EINVAL;
 
-	entry = debugfs_create_dir("debug", dpu_kms->dev->primary->debugfs_root);
+	entry = debugfs_create_dir("debug", minor->debugfs_root);
 	if (IS_ERR_OR_NULL(entry))
 		return -ENODEV;
 
@@ -581,7 +581,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 2019-05-24 10:32, 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 the debug directory under /sys/kernel/debug/ and
> instead creates the directory under the correct node in
> /sys/kernel/debug/dri/<node>/
> 
> Reported-by: Stephen Boyd <swboyd@chromium.org>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 885bf88afa3e..d77071965431 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -231,7 +231,7 @@ 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;
> @@ -239,7 +239,7 @@ static int _dpu_debugfs_init(struct dpu_kms 
> *dpu_kms)
>  	if (!p)
>  		return -EINVAL;
> 
> -	entry = debugfs_create_dir("debug", 
> dpu_kms->dev->primary->debugfs_root);
> +	entry = debugfs_create_dir("debug", minor->debugfs_root);
>  	if (IS_ERR_OR_NULL(entry))
>  		return -ENODEV;
> 
> @@ -581,7 +581,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
Quoting Sean Paul (2019-05-24 10:32:18)
> 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 the debug directory under /sys/kernel/debug/ and
> instead creates the directory under the correct node in
> /sys/kernel/debug/dri/<node>/

So does this make it become /sys/kernel/debug/dri/<node>/debug?

I wonder why it can't all be created under /sys/kernel/debug/dri/<node>
and then avoid the extra "debug" directory that isn't adding any value?
On Fri, May 24, 2019 at 1:43 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Sean Paul (2019-05-24 10:32:18)
> > 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 the debug directory under /sys/kernel/debug/ and
> > instead creates the directory under the correct node in
> > /sys/kernel/debug/dri/<node>/
>
> So does this make it become /sys/kernel/debug/dri/<node>/debug?
>
> I wonder why it can't all be created under /sys/kernel/debug/dri/<node>
> and then avoid the extra "debug" directory that isn't adding any value?
>

From the looks of it, it will still create the 'debug' dir, but at
least under the correct <node>..

for the record, I'm all for getting rid of the extra 'debug'
directory, it saves me some extra typing ;-)

BR,
-R