drm/amd/pm: drop unneeded smu_baco->mutex
authorEvan Quan <evan.quan@amd.com>
Mon, 29 Nov 2021 06:02:25 +0000 (14:02 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Jan 2022 23:00:32 +0000 (18:00 -0500)
As those APIs related are already well protected by adev->pm.mutex.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

index 57f3d26b03fe24e8a0408a503cf4f43c54200e58..fe155a7874b0b7f880c2aeb4a5f52f6c1c054f8d 100644 (file)
@@ -567,7 +567,6 @@ static int smu_early_init(void *handle)
        smu->adev = adev;
        smu->pm_enabled = !!amdgpu_dpm;
        smu->is_apu = false;
-       mutex_init(&smu->smu_baco.mutex);
        smu->smu_baco.state = SMU_BACO_STATE_EXIT;
        smu->smu_baco.platform_support = false;
        smu->user_dpm_profile.fan_mode = -1;
index 2cef7ff46010c9dd8fd18a43bb4af090abfee366..79b2a817491c4fb0efa8b646e442f288c92d30f7 100644 (file)
@@ -428,7 +428,6 @@ enum smu_baco_state
 
 struct smu_baco_context
 {
-       struct mutex mutex;
        uint32_t state;
        bool platform_support;
 };
index e94a400db66917c7125fcc591cf4175acbb8122e..b58a4c2823c2fae79e1f844eda3c1468b023c2d7 100644 (file)
@@ -1617,13 +1617,8 @@ bool smu_v11_0_baco_is_support(struct smu_context *smu)
 enum smu_baco_state smu_v11_0_baco_get_state(struct smu_context *smu)
 {
        struct smu_baco_context *smu_baco = &smu->smu_baco;
-       enum smu_baco_state baco_state;
 
-       mutex_lock(&smu_baco->mutex);
-       baco_state = smu_baco->state;
-       mutex_unlock(&smu_baco->mutex);
-
-       return baco_state;
+       return smu_baco->state;
 }
 
 #define D3HOT_BACO_SEQUENCE 0
@@ -1640,8 +1635,6 @@ int smu_v11_0_baco_set_state(struct smu_context *smu, enum smu_baco_state state)
        if (smu_v11_0_baco_get_state(smu) == state)
                return 0;
 
-       mutex_lock(&smu_baco->mutex);
-
        if (state == SMU_BACO_STATE_ENTER) {
                switch (adev->ip_versions[MP1_HWIP][0]) {
                case IP_VERSION(11, 0, 7):
@@ -1682,18 +1675,16 @@ int smu_v11_0_baco_set_state(struct smu_context *smu, enum smu_baco_state state)
        } else {
                ret = smu_cmn_send_smc_msg(smu, SMU_MSG_ExitBaco, NULL);
                if (ret)
-                       goto out;
+                       return ret;
 
                /* clear vbios scratch 6 and 7 for coming asic reinit */
                WREG32(adev->bios_scratch_reg_offset + 6, 0);
                WREG32(adev->bios_scratch_reg_offset + 7, 0);
        }
-       if (ret)
-               goto out;
 
-       smu_baco->state = state;
-out:
-       mutex_unlock(&smu_baco->mutex);
+       if (!ret)
+               smu_baco->state = state;
+
        return ret;
 }