Commit a035be8a authored by Mario Limonciello's avatar Mario Limonciello Committed by Alex Deucher

drm/amd/pm: Adjust returns when power_profile_mode is not supported

This better aligns that the caller can make a mistake with the buffer
and -EINVAL should be returned, but if the hardware doesn't support
the feature it should be -EOPNOTSUPP.
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 06755817
...@@ -877,7 +877,9 @@ static int pp_get_power_profile_mode(void *handle, char *buf) ...@@ -877,7 +877,9 @@ static int pp_get_power_profile_mode(void *handle, char *buf)
struct pp_hwmgr *hwmgr = handle; struct pp_hwmgr *hwmgr = handle;
int ret; int ret;
if (!hwmgr || !hwmgr->pm_en || !buf) if (!hwmgr || !hwmgr->pm_en)
return -EOPNOTSUPP;
if (!buf)
return -EINVAL; return -EINVAL;
if (hwmgr->hwmgr_func->get_power_profile_mode == NULL) { if (hwmgr->hwmgr_func->get_power_profile_mode == NULL) {
...@@ -894,7 +896,7 @@ static int pp_get_power_profile_mode(void *handle, char *buf) ...@@ -894,7 +896,7 @@ static int pp_get_power_profile_mode(void *handle, char *buf)
static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size) static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size)
{ {
struct pp_hwmgr *hwmgr = handle; struct pp_hwmgr *hwmgr = handle;
int ret = -EINVAL; int ret = -EOPNOTSUPP;
if (!hwmgr || !hwmgr->pm_en) if (!hwmgr || !hwmgr->pm_en)
return ret; return ret;
...@@ -906,7 +908,7 @@ static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size) ...@@ -906,7 +908,7 @@ static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size)
if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) { if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) {
pr_debug("power profile setting is for manual dpm mode only.\n"); pr_debug("power profile setting is for manual dpm mode only.\n");
return ret; return -EINVAL;
} }
mutex_lock(&hwmgr->smu_lock); mutex_lock(&hwmgr->smu_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment