mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-18 06:33:43 -04:00
drm/amdgpu: validate suspend before function call
Before making a function call to suspend, validate the function pointer like we do in sw_init. Use the helper function amdgpu_ip_block_suspend where same checks and calls are repeated. Signed-off-by: Sunil Khatri <sunil.khatri@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
dad01f93f4
commit
e095026f00
@@ -272,6 +272,24 @@ void amdgpu_reg_state_sysfs_fini(struct amdgpu_device *adev)
|
||||
sysfs_remove_bin_file(&adev->dev->kobj, &bin_attr_reg_state);
|
||||
}
|
||||
|
||||
int amdgpu_ip_block_suspend(struct amdgpu_ip_block *ip_block)
|
||||
{
|
||||
int r;
|
||||
|
||||
if (ip_block->version->funcs->suspend) {
|
||||
r = ip_block->version->funcs->suspend(ip_block);
|
||||
if (r) {
|
||||
dev_err(ip_block->adev->dev,
|
||||
"suspend of IP block <%s> failed %d\n",
|
||||
ip_block->version->funcs->name, r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
ip_block->status.hw = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC: board_info
|
||||
*
|
||||
@@ -3473,15 +3491,9 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)
|
||||
continue;
|
||||
|
||||
/* XXX handle errors */
|
||||
r = adev->ip_blocks[i].version->funcs->suspend(&adev->ip_blocks[i]);
|
||||
/* XXX handle errors */
|
||||
if (r) {
|
||||
DRM_ERROR("suspend of IP block <%s> failed %d\n",
|
||||
adev->ip_blocks[i].version->funcs->name, r);
|
||||
r = amdgpu_ip_block_suspend(&adev->ip_blocks[i]);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
adev->ip_blocks[i].status.hw = false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -3555,13 +3567,9 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
|
||||
continue;
|
||||
|
||||
/* XXX handle errors */
|
||||
r = adev->ip_blocks[i].version->funcs->suspend(&adev->ip_blocks[i]);
|
||||
/* XXX handle errors */
|
||||
if (r) {
|
||||
DRM_ERROR("suspend of IP block <%s> failed %d\n",
|
||||
adev->ip_blocks[i].version->funcs->name, r);
|
||||
}
|
||||
r = amdgpu_ip_block_suspend(&adev->ip_blocks[i]);
|
||||
adev->ip_blocks[i].status.hw = false;
|
||||
|
||||
/* handle putting the SMC in the appropriate state */
|
||||
if (!amdgpu_sriov_vf(adev)) {
|
||||
if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) {
|
||||
|
||||
Reference in New Issue
Block a user