Same logic as the previous commit ("drm/amdgpu/pm: use
pm_runtime_get_if_active for debugfs getters"): debugfs accesses shouldn't
wake up the GPU nor preventing it to be suspended.

Tested-by: Mario Limonciello <mario.limoncie...@amd.com>
Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-pra...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 37d8657f0776..af31e94c3eb6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -989,11 +989,9 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, 
char __user *buf,
 
        valuesize = sizeof(values);
 
-       r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
-       if (r < 0) {
-               pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
-               return r;
-       }
+       r = pm_runtime_get_if_active(adev->dev, true);
+       if (r <= 0)
+               return r ?: -EPERM;
 
        r = amdgpu_virt_enable_access_debugfs(adev);
        if (r < 0) {
@@ -1003,7 +1001,6 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, 
char __user *buf,
 
        r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize);
 
-       pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
        pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
 
        if (r) {
-- 
2.40.1

Reply via email to