drm/amd/pm: refine amdgpu pm sysfs node error code
Subsystems (3)
PATCH 1/1 drm/amd/pm: refine amdgpu pm sysfs node error code
Returns different error codes based on the scenario to help the user app understand the AMDGPU device status when an exception occurs.
--- 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
@@ -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 -ENODEV ;return 0 ; }
Signature · 1 line
2.34.1
[Public]
I don't think it requires two separate error codes. The error scenario is device cannot be accessed at this point of time (that's regardless of suspend or while device is undergoing reset).
Thanks,
Lijo
-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Wednesday, September 3, 2025 12:05 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Lazar, Lijo <[email protected]>
Subject: [PATCH] drm/amd/pm: refine amdgpu pm sysfs node error code
Returns different error codes based on the scenario to help the user app understand the AMDGPU device status when an exception occurs.
--- 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
@@ -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 -ENODEV ;return 0 ; }
--
2.34.1
[Public]
let me send another patch to unified error code to -EBUSY to distinguish the return value of runpm -EPERM.
Best Regards,
Kevin
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 3, 2025 3:08 PM
To: Wang, Yang(Kevin) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: refine amdgpu pm sysfs node error code
[Public]
I don't think it requires two separate error codes. The error scenario is device cannot be accessed at this point of time (that's regardless of suspend or while device is undergoing reset).
Thanks,
Lijo
-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Wednesday, September 3, 2025 12:05 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Lazar, Lijo <[email protected]>
Subject: [PATCH] drm/amd/pm: refine amdgpu pm sysfs node error code
Returns different error codes based on the scenario to help the user app understand the AMDGPU device status when an exception occurs.
--- 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
@@ -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 -ENODEV ;return 0 ; }
--
2.34.1