diff options
author | Nirmoy Das <nirmoy.das@amd.com> | 2021-02-14 21:56:55 +0100 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-02-18 16:43:09 -0500 |
commit | 373720f79d56697f0f63cbda50111d6eb6dbad2f (patch) | |
tree | 173ceee8fa45014edba50b58db8845c47eb75681 /drivers/gpu/drm/amd | |
parent | afd3a359c452c5ee529a6b1d660ebf1176765463 (diff) | |
download | lwn-373720f79d56697f0f63cbda50111d6eb6dbad2f.tar.gz lwn-373720f79d56697f0f63cbda50111d6eb6dbad2f.zip |
drm/amd/pm: do not use drm middle layer for debugfs
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>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/pm/amdgpu_pm.c | 25 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h | 2 |
3 files changed, 14 insertions, 19 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c index 67b130cef19a..1b754ad237fa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -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"); diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index 5fa65f191a37..b770dd634ab6 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -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" @@ -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; @@ -3836,16 +3833,18 @@ out: 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 } diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h index 45a22e101d15..a920515e2274 100644 --- a/drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h +++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h @@ -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 |