Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd: Remove second call to set_power_limit()

The min/max limits only make sense for default PPT. Restructure
smu_set_power_limit() to only use them in that case.

Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Mario Limonciello and committed by
Alex Deucher
56a207c3 5f4f49a4

+9 -12
+9 -12
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 2966 2966 if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) 2967 2967 return -EOPNOTSUPP; 2968 2968 2969 - if (limit_type != SMU_DEFAULT_PPT_LIMIT) 2970 - if (smu->ppt_funcs->set_power_limit) 2971 - return smu->ppt_funcs->set_power_limit(smu, limit_type, limit); 2972 - 2973 - if ((limit > smu->max_power_limit) || (limit < smu->min_power_limit)) { 2974 - dev_err(smu->adev->dev, 2975 - "New power limit (%d) is out of range [%d,%d]\n", 2976 - limit, smu->min_power_limit, smu->max_power_limit); 2977 - return -EINVAL; 2969 + if (limit_type == SMU_DEFAULT_PPT_LIMIT) { 2970 + if (!limit) 2971 + limit = smu->current_power_limit; 2972 + if ((limit > smu->max_power_limit) || (limit < smu->min_power_limit)) { 2973 + dev_err(smu->adev->dev, 2974 + "New power limit (%d) is out of range [%d,%d]\n", 2975 + limit, smu->min_power_limit, smu->max_power_limit); 2976 + return -EINVAL; 2977 + } 2978 2978 } 2979 - 2980 - if (!limit) 2981 - limit = smu->current_power_limit; 2982 2979 2983 2980 if (smu->ppt_funcs->set_power_limit) { 2984 2981 ret = smu->ppt_funcs->set_power_limit(smu, limit_type, limit);