diff options
author | Xiang Liu <xiang.liu@amd.com> | 2025-02-19 12:21:59 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2025-02-19 15:16:33 -0500 |
commit | 663a87763b570d4e92d821b30508bed0025fa285 (patch) | |
tree | 360cf1c206281d13f2190f49b9dd89ab834c4533 | |
parent | 30eb41f5d1a7ac6bb9b8f624dee5e545f8ee2c8e (diff) |
drm/amdgpu: Check aca enabled inside cper init/fini func
Move code about checking aca enabled to the cper init/fini function
to make code clean.
Signed-off-by: Xiang Liu <xiang.liu@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c index 8805381e19b9..20c474a32852 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c @@ -538,6 +538,9 @@ static int amdgpu_cper_ring_init(struct amdgpu_device *adev) int amdgpu_cper_init(struct amdgpu_device *adev) { + if (!amdgpu_aca_is_enabled(adev)) + return 0; + mutex_init(&adev->cper.cper_lock); adev->cper.enabled = true; @@ -548,6 +551,9 @@ int amdgpu_cper_init(struct amdgpu_device *adev) int amdgpu_cper_fini(struct amdgpu_device *adev) { + if (!amdgpu_aca_is_enabled(adev)) + return 0; + adev->cper.enabled = false; amdgpu_ring_fini(&(adev->cper.ring_buf)); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 5aa0b4032291..38260ffac6ee 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -3091,8 +3091,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) amdgpu_fru_get_product_info(adev); - if (amdgpu_aca_is_enabled(adev)) - r = amdgpu_cper_init(adev); + r = amdgpu_cper_init(adev); init_failed: @@ -3454,8 +3453,7 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev) { int i, r; - if (amdgpu_aca_is_enabled(adev)) - amdgpu_cper_fini(adev); + amdgpu_cper_fini(adev); if (amdgpu_sriov_vf(adev) && adev->virt.ras_init_done) amdgpu_virt_release_ras_err_handler_data(adev); |