Skip to content

Commit

Permalink
drm/amd/pm: do not use drm middle layer for debugfs
Browse files Browse the repository at this point in the history
Use debugfs API directly instead of drm middle layer.

v2: * checkpatch.pl: use '0444' instead of S_IRUGO.
    * remove S_IFREG from mode.
    * remove mode variable.

Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Nirmoy Das authored and Alex Deucher committed Feb 18, 2021
1 parent afd3a35 commit 373720f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
6 changes: 1 addition & 5 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1619,11 +1619,7 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
return r;
}

r = amdgpu_debugfs_pm_init(adev);
if (r) {
DRM_ERROR("Failed to register debugfs file for dpm!\n");
return r;
}
amdgpu_debugfs_pm_init(adev);

if (amdgpu_debugfs_sa_init(adev)) {
dev_err(adev->dev, "failed to register debugfs file for SA\n");
Expand Down
25 changes: 12 additions & 13 deletions drivers/gpu/drm/amd/pm/amdgpu_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
* Alex Deucher <alexdeucher@gmail.com>
*/

#include <drm/drm_debugfs.h>

#include "amdgpu.h"
#include "amdgpu_drv.h"
#include "amdgpu_pm.h"
Expand Down Expand Up @@ -3784,11 +3782,10 @@ static void amdgpu_parse_cg_state(struct seq_file *m, u32 flags)
(flags & clocks[i].flag) ? "On" : "Off");
}

static int amdgpu_debugfs_pm_info(struct seq_file *m, void *data)
static int amdgpu_debugfs_pm_info_show(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 amdgpu_device *adev = drm_to_adev(dev);
struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
struct drm_device *dev = adev_to_drm(adev);
u32 flags = 0;
int r;

Expand Down Expand Up @@ -3836,16 +3833,18 @@ static int amdgpu_debugfs_pm_info(struct seq_file *m, void *data)
return r;
}

static const struct drm_info_list amdgpu_pm_info_list[] = {
{"amdgpu_pm_info", amdgpu_debugfs_pm_info, 0, NULL},
};
DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_pm_info);

#endif

int amdgpu_debugfs_pm_init(struct amdgpu_device *adev)
void amdgpu_debugfs_pm_init(struct amdgpu_device *adev)
{
#if defined(CONFIG_DEBUG_FS)
return amdgpu_debugfs_add_files(adev, amdgpu_pm_info_list, ARRAY_SIZE(amdgpu_pm_info_list));
#else
return 0;
struct drm_minor *minor = adev_to_drm(adev)->primary;
struct dentry *root = minor->debugfs_root;

debugfs_create_file("amdgpu_pm_info", 0444, root, adev,
&amdgpu_debugfs_pm_info_fops);

#endif
}
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ int amdgpu_pm_virt_sysfs_init(struct amdgpu_device *adev);
void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev);
void amdgpu_pm_virt_sysfs_fini(struct amdgpu_device *adev);

int amdgpu_debugfs_pm_init(struct amdgpu_device *adev);
void amdgpu_debugfs_pm_init(struct amdgpu_device *adev);

#endif

0 comments on commit 373720f

Please sign in to comment.