]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/pm: refine amdgpu pm sysfs node error code
authorYang Wang <kevinyang.wang@amd.com>
Wed, 3 Sep 2025 06:29:12 +0000 (14:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:37:15 +0000 (15:37 -0500)
[ Upstream commit cf32515a70618c0fb2319bd4a855f4d9447940a8 ]

v1:
Returns different error codes based on the scenario to help the user app understand
the AMDGPU device status when an exception occurs.

v2:
change -NODEV to -EBUSY.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/pm/amdgpu_pm.c

index 5fbfe7333b54df51942c43b8bf2577cf7270c561..1fca183827c7c490b9d79836b98cb74163092e80 100644 (file)
@@ -110,9 +110,10 @@ static int amdgpu_pm_dev_state_check(struct amdgpu_device *adev, bool runpm)
        bool runpm_check = runpm ? adev->in_runpm : false;
 
        if (amdgpu_in_reset(adev))
-               return -EPERM;
+               return -EBUSY;
+
        if (adev->in_suspend && !runpm_check)
-               return -EPERM;
+               return -EBUSY;
 
        return 0;
 }