summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
authorAlex Jivin <alex.jivin@amd.com>2020-07-06 11:07:19 -0400
committerAlex Deucher <alexander.deucher@amd.com>2020-07-08 09:02:43 -0400
commitfa4a882008a71bf18a30c7f548572ecf19882fbd (patch)
treeddabe8681562a2569c0a56cd9a7621b069cfa2af /drivers/gpu/drm/amd/amdgpu
parent74772649ab18bc90657420c94b2c57f0f9dc8299 (diff)
drm/amdgpu: Move the mutex lock/unlock out
Move the mutext lock/unlock outside of the if(), as the mutex is always taken: either in the if() branch or in the else branch. Signed-off-by: Alex Jivin <alex.jivin@amd.com> Suggested-By: Luben Tukov <luben.tuikov@amd.com> Reviewed-by: Luben Tuikov <luben.tuikov@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 838d6d51904c..d2401379bd33 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -3559,16 +3559,14 @@ void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable)
int ret = 0;
if (adev->family == AMDGPU_FAMILY_SI) {
+ mutex_lock(&adev->pm.mutex);
if (enable) {
- mutex_lock(&adev->pm.mutex);
adev->pm.dpm.uvd_active = true;
adev->pm.dpm.state = POWER_STATE_TYPE_INTERNAL_UVD;
- mutex_unlock(&adev->pm.mutex);
} else {
- mutex_lock(&adev->pm.mutex);
adev->pm.dpm.uvd_active = false;
- mutex_unlock(&adev->pm.mutex);
}
+ mutex_unlock(&adev->pm.mutex);
amdgpu_pm_compute_clocks(adev);
} else {
@@ -3596,17 +3594,15 @@ void amdgpu_dpm_enable_vce(struct amdgpu_device *adev, bool enable)
int ret = 0;
if (adev->family == AMDGPU_FAMILY_SI) {
+ mutex_lock(&adev->pm.mutex);
if (enable) {
- mutex_lock(&adev->pm.mutex);
adev->pm.dpm.vce_active = true;
/* XXX select vce level based on ring/task */
adev->pm.dpm.vce_level = AMD_VCE_LEVEL_AC_ALL;
- mutex_unlock(&adev->pm.mutex);
} else {
- mutex_lock(&adev->pm.mutex);
adev->pm.dpm.vce_active = false;
- mutex_unlock(&adev->pm.mutex);
}
+ mutex_unlock(&adev->pm.mutex);
amdgpu_pm_compute_clocks(adev);
} else {