diff options
author | yipechai <YiPeng.Chai@amd.com> | 2022-02-08 10:42:47 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2022-02-14 15:08:41 -0500 |
commit | cb9561d0e3f4393a31fab2034c33c6cf2162513a (patch) | |
tree | e62f3081a20227a989e636b1b18f012c1d00b857 | |
parent | 88bc3cd8450b73ad37c9de4b48c315e6c8002f03 (diff) |
drm/amdgpu: Optimize amdgpu_mmhub_ras_late_init/amdgpu_mmhub_ras_fini function code
Optimize amdgpu_mmhub_ras_late_init/amdgpu_mmhub_ras_fini function code.
Signed-off-by: yipechai <YiPeng.Chai@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_mmhub.c | 37 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 |
2 files changed, 5 insertions, 34 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c index f9b5472a75d7..2bdb4d8b7955 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c @@ -26,43 +26,12 @@ int amdgpu_mmhub_ras_late_init(struct amdgpu_device *adev, void *ras_info) { - int r; - struct ras_ih_if ih_info = { - .cb = NULL, - }; - struct ras_fs_if fs_info = { - .sysfs_name = "mmhub_err_count", - }; - - if (!adev->mmhub.ras_if) { - adev->mmhub.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL); - if (!adev->mmhub.ras_if) - return -ENOMEM; - adev->mmhub.ras_if->block = AMDGPU_RAS_BLOCK__MMHUB; - adev->mmhub.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE; - adev->mmhub.ras_if->sub_block_index = 0; - } - ih_info.head = fs_info.head = *adev->mmhub.ras_if; - r = amdgpu_ras_late_init(adev, adev->mmhub.ras_if, - &fs_info, &ih_info); - if (r || !amdgpu_ras_is_supported(adev, adev->mmhub.ras_if->block)) { - kfree(adev->mmhub.ras_if); - adev->mmhub.ras_if = NULL; - } - - return r; + return amdgpu_ras_block_late_init(adev, adev->mmhub.ras_if); } void amdgpu_mmhub_ras_fini(struct amdgpu_device *adev) { if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__MMHUB) && - adev->mmhub.ras_if) { - struct ras_common_if *ras_if = adev->mmhub.ras_if; - struct ras_ih_if ih_info = { - .cb = NULL, - }; - - amdgpu_ras_late_fini(adev, ras_if, &ih_info); - kfree(ras_if); - } + adev->mmhub.ras_if) + amdgpu_ras_block_late_fini(adev, adev->mmhub.ras_if); } diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index b12fe6703f02..15958fd45f64 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -1282,6 +1282,8 @@ static void gmc_v9_0_set_mmhub_ras_funcs(struct amdgpu_device *adev) strcpy(adev->mmhub.ras->ras_block.ras_comm.name, "mmhub"); adev->mmhub.ras->ras_block.ras_comm.block = AMDGPU_RAS_BLOCK__MMHUB; + adev->mmhub.ras->ras_block.ras_comm.type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE; + adev->mmhub.ras_if = &adev->mmhub.ras->ras_block.ras_comm; /* If don't define special ras_late_init function, use default ras_late_init */ if (!adev->mmhub.ras->ras_block.ras_late_init) |