diff options
| author | Darren Powell <[email protected]> | 2021-05-26 22:47:10 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2021-06-08 16:14:03 +0000 |
| commit | dc2a8240b2ae8cc2edef3a6e978d249ea2bb8955 (patch) | |
| tree | e64c3067951f5f56f456c8a4f6285cdd1128f6a0 /drivers/gpu/drm/amd/pm/amdgpu_pm.c | |
| parent | amdgpu/pm: modify and add smu_get_power_limit to Powerplay API (diff) | |
| download | kernel-dc2a8240b2ae8cc2edef3a6e978d249ea2bb8955.tar.gz kernel-dc2a8240b2ae8cc2edef3a6e978d249ea2bb8955.zip | |
amdgpu/pm: handle return value for get_power_limit
Signed-off-by: Darren Powell <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/pm/amdgpu_pm.c')
| -rw-r--r-- | drivers/gpu/drm/amd/pm/amdgpu_pm.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index 0a788cb38ee2..b2335a1d3f98 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -2924,13 +2924,16 @@ static ssize_t amdgpu_hwmon_show_power_cap_max(struct device *dev, return r; } - if (pp_funcs && pp_funcs->get_power_limit) { - pp_funcs->get_power_limit(adev->powerplay.pp_handle, &limit, - pp_limit_level, power_type); + if (pp_funcs && pp_funcs->get_power_limit) + r = pp_funcs->get_power_limit(adev->powerplay.pp_handle, &limit, + pp_limit_level, power_type); + else + r = -ENODATA; + + if (!r) size = snprintf(buf, PAGE_SIZE, "%u\n", limit * 1000000); - } else { + else size = snprintf(buf, PAGE_SIZE, "\n"); - } pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); @@ -2961,13 +2964,16 @@ static ssize_t amdgpu_hwmon_show_power_cap(struct device *dev, return r; } - if (pp_funcs && pp_funcs->get_power_limit) { - pp_funcs->get_power_limit(adev->powerplay.pp_handle, &limit, - pp_limit_level, power_type); + if (pp_funcs && pp_funcs->get_power_limit) + r = pp_funcs->get_power_limit(adev->powerplay.pp_handle, &limit, + pp_limit_level, power_type); + else + r = -ENODATA; + + if (!r) size = snprintf(buf, PAGE_SIZE, "%u\n", limit * 1000000); - } else { + else size = snprintf(buf, PAGE_SIZE, "\n"); - } pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); @@ -2998,13 +3004,16 @@ static ssize_t amdgpu_hwmon_show_power_cap_default(struct device *dev, return r; } - if (pp_funcs && pp_funcs->get_power_limit) { - pp_funcs->get_power_limit(adev->powerplay.pp_handle, &limit, - pp_limit_level, power_type); + if (pp_funcs && pp_funcs->get_power_limit) + r = pp_funcs->get_power_limit(adev->powerplay.pp_handle, &limit, + pp_limit_level, power_type); + else + r = -ENODATA; + + if (!r) size = snprintf(buf, PAGE_SIZE, "%u\n", limit * 1000000); - } else { + else size = snprintf(buf, PAGE_SIZE, "\n"); - } pm_runtime_mark_last_busy(adev_to_drm(adev)->dev); pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); |
