mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
drm/amdgpu: Optimize amdgpu_hdp_ras_late_init/amdgpu_hdp_ras_fini function code
Optimize amdgpu_hdp_ras_late_init/amdgpu_hdp_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>
This commit is contained in:
parent
311065086e
commit
634b56b0f8
|
|
@ -26,43 +26,12 @@
|
|||
|
||||
int amdgpu_hdp_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 = "hdp_err_count",
|
||||
};
|
||||
|
||||
if (!adev->hdp.ras_if) {
|
||||
adev->hdp.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
|
||||
if (!adev->hdp.ras_if)
|
||||
return -ENOMEM;
|
||||
adev->hdp.ras_if->block = AMDGPU_RAS_BLOCK__HDP;
|
||||
adev->hdp.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
|
||||
adev->hdp.ras_if->sub_block_index = 0;
|
||||
}
|
||||
ih_info.head = fs_info.head = *adev->hdp.ras_if;
|
||||
r = amdgpu_ras_late_init(adev, adev->hdp.ras_if,
|
||||
&fs_info, &ih_info);
|
||||
if (r || !amdgpu_ras_is_supported(adev, adev->hdp.ras_if->block)) {
|
||||
kfree(adev->hdp.ras_if);
|
||||
adev->hdp.ras_if = NULL;
|
||||
}
|
||||
|
||||
return r;
|
||||
return amdgpu_ras_block_late_init(adev, adev->hdp.ras_if);
|
||||
}
|
||||
|
||||
void amdgpu_hdp_ras_fini(struct amdgpu_device *adev)
|
||||
{
|
||||
if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__HDP) &&
|
||||
adev->hdp.ras_if) {
|
||||
struct ras_common_if *ras_if = adev->hdp.ras_if;
|
||||
struct ras_ih_if ih_info = {
|
||||
.cb = NULL,
|
||||
};
|
||||
|
||||
amdgpu_ras_late_fini(adev, ras_if, &ih_info);
|
||||
kfree(ras_if);
|
||||
}
|
||||
adev->hdp.ras_if)
|
||||
amdgpu_ras_block_late_fini(adev, adev->hdp.ras_if);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1302,6 +1302,7 @@ static void gmc_v9_0_set_hdp_ras_funcs(struct amdgpu_device *adev)
|
|||
{
|
||||
adev->hdp.ras = &hdp_v4_0_ras;
|
||||
amdgpu_ras_register_ras_block(adev, &adev->hdp.ras->ras_block);
|
||||
adev->hdp.ras_if = &adev->hdp.ras->ras_block.ras_comm;
|
||||
}
|
||||
|
||||
static void gmc_v9_0_set_mca_funcs(struct amdgpu_device *adev)
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ struct amdgpu_hdp_ras hdp_v4_0_ras = {
|
|||
.ras_comm = {
|
||||
.name = "hdp",
|
||||
.block = AMDGPU_RAS_BLOCK__HDP,
|
||||
.type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE,
|
||||
},
|
||||
.hw_ops = &hdp_v4_0_ras_hw_ops,
|
||||
.ras_late_init = amdgpu_hdp_ras_late_init,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user