Skip to contentSkip to conversation

drm/amd/pm: refine amdgpu pm sysfs node error code

PATCH In review Yang Wang 2 participants 2 messages Sep 3, 2025

Subsystems (3)
lore
Share & tools
lore

Yang Wang

author
#0 lore raw

PATCH v2 1/1 drm/amd/pm: refine amdgpu pm sysfs node error code

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.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3 -2
index 0906bff864cb..c2095fce694f 100644
@@ -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;
 }
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw

[Public]

Thanks,
Lijo

-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Wednesday, September 3, 2025 1:44 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Lazar, Lijo <[email protected]>
Subject: [PATCH v2] drm/amd/pm: refine amdgpu pm sysfs node error code

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.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3 -2
index 0906bff864cb..c2095fce694f 100644
@@ -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;
 }

--
2.34.1