Commit 27414cd4 authored by Alex Deucher's avatar Alex Deucher

drm/amdgpu/pm: clean up return types

count is size_t so don't use negative values.
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 56822db1
...@@ -206,10 +206,8 @@ static ssize_t amdgpu_set_dpm_state(struct device *dev, ...@@ -206,10 +206,8 @@ static ssize_t amdgpu_set_dpm_state(struct device *dev,
state = POWER_STATE_TYPE_BALANCED; state = POWER_STATE_TYPE_BALANCED;
else if (strncmp("performance", buf, strlen("performance")) == 0) else if (strncmp("performance", buf, strlen("performance")) == 0)
state = POWER_STATE_TYPE_PERFORMANCE; state = POWER_STATE_TYPE_PERFORMANCE;
else { else
count = -EINVAL; return -EINVAL;
goto fail;
}
ret = pm_runtime_get_sync(ddev->dev); ret = pm_runtime_get_sync(ddev->dev);
if (ret < 0) if (ret < 0)
...@@ -231,8 +229,6 @@ static ssize_t amdgpu_set_dpm_state(struct device *dev, ...@@ -231,8 +229,6 @@ static ssize_t amdgpu_set_dpm_state(struct device *dev,
pm_runtime_mark_last_busy(ddev->dev); pm_runtime_mark_last_busy(ddev->dev);
pm_runtime_put_autosuspend(ddev->dev); pm_runtime_put_autosuspend(ddev->dev);
fail:
return count; return count;
} }
...@@ -399,8 +395,11 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev, ...@@ -399,8 +395,11 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
if (is_support_sw_smu(adev)) { if (is_support_sw_smu(adev)) {
ret = smu_force_performance_level(&adev->smu, level); ret = smu_force_performance_level(&adev->smu, level);
if (ret) if (ret) {
count = -EINVAL; pm_runtime_mark_last_busy(ddev->dev);
pm_runtime_put_autosuspend(ddev->dev);
return -EINVAL;
}
} else if (adev->powerplay.pp_funcs->force_performance_level) { } else if (adev->powerplay.pp_funcs->force_performance_level) {
mutex_lock(&adev->pm.mutex); mutex_lock(&adev->pm.mutex);
if (adev->pm.dpm.thermal_active) { if (adev->pm.dpm.thermal_active) {
...@@ -410,10 +409,14 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev, ...@@ -410,10 +409,14 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
return -EINVAL; return -EINVAL;
} }
ret = amdgpu_dpm_force_performance_level(adev, level); ret = amdgpu_dpm_force_performance_level(adev, level);
if (ret) if (ret) {
count = -EINVAL; mutex_unlock(&adev->pm.mutex);
else pm_runtime_mark_last_busy(ddev->dev);
pm_runtime_put_autosuspend(ddev->dev);
return -EINVAL;
} else {
adev->pm.dpm.forced_level = level; adev->pm.dpm.forced_level = level;
}
mutex_unlock(&adev->pm.mutex); mutex_unlock(&adev->pm.mutex);
} }
pm_runtime_mark_last_busy(ddev->dev); pm_runtime_mark_last_busy(ddev->dev);
...@@ -890,12 +893,18 @@ static ssize_t amdgpu_set_pp_feature_status(struct device *dev, ...@@ -890,12 +893,18 @@ static ssize_t amdgpu_set_pp_feature_status(struct device *dev,
if (is_support_sw_smu(adev)) { if (is_support_sw_smu(adev)) {
ret = smu_sys_set_pp_feature_mask(&adev->smu, featuremask); ret = smu_sys_set_pp_feature_mask(&adev->smu, featuremask);
if (ret) if (ret) {
count = -EINVAL; pm_runtime_mark_last_busy(ddev->dev);
pm_runtime_put_autosuspend(ddev->dev);
return -EINVAL;
}
} else if (adev->powerplay.pp_funcs->set_ppfeature_status) { } else if (adev->powerplay.pp_funcs->set_ppfeature_status) {
ret = amdgpu_dpm_set_ppfeature_status(adev, featuremask); ret = amdgpu_dpm_set_ppfeature_status(adev, featuremask);
if (ret) if (ret) {
count = -EINVAL; pm_runtime_mark_last_busy(ddev->dev);
pm_runtime_put_autosuspend(ddev->dev);
return -EINVAL;
}
} }
pm_runtime_mark_last_busy(ddev->dev); pm_runtime_mark_last_busy(ddev->dev);
pm_runtime_put_autosuspend(ddev->dev); pm_runtime_put_autosuspend(ddev->dev);
......
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