aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorTom St Denis <tom.stdenis@amd.com>2017-09-05 07:55:48 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-09-12 14:23:18 -0400
commit64d03abe6ee36ec48e997743e9397ae160eb508a (patch)
treed8070fd7b1d40fa8f9091adbd99e4712a7a7b9cf /drivers/gpu/drm
parenta216ab09955d6b77f3af4f0aba9255c5ddf382f5 (diff)
drm/amd/powerplay: Fix psm_set_user_performance_state()
We now pass a pointer to a pointer which seems to be what they meant in the first place. The previous version was modifying a pointer passed by value. Fixes bug that was introduced by commit 332798d40c2e91:drm/amd/powerplay: delete eventmgr layer in poweprlay Signed-off-by: Tom St Denis <tom.stdenis@amd.com> Reviewed-By: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c4
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c8
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h2
3 files changed, 7 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index c6157bcdf7d6..4f1b932361b2 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -294,7 +294,7 @@ int hwmgr_handle_task(struct pp_instance *handle, enum amd_pp_task task_id,
294 { 294 {
295 enum amd_pm_state_type ps; 295 enum amd_pm_state_type ps;
296 enum PP_StateUILabel requested_ui_label; 296 enum PP_StateUILabel requested_ui_label;
297 struct pp_power_state *requested_ps; 297 struct pp_power_state *requested_ps = NULL;
298 298
299 if (input == NULL) { 299 if (input == NULL) {
300 ret = -EINVAL; 300 ret = -EINVAL;
@@ -303,7 +303,7 @@ int hwmgr_handle_task(struct pp_instance *handle, enum amd_pp_task task_id,
303 ps = *(unsigned long *)input; 303 ps = *(unsigned long *)input;
304 304
305 requested_ui_label = power_state_convert(ps); 305 requested_ui_label = power_state_convert(ps);
306 ret = psm_set_user_performance_state(hwmgr, requested_ui_label, requested_ps); 306 ret = psm_set_user_performance_state(hwmgr, requested_ui_label, &requested_ps);
307 if (ret) 307 if (ret)
308 return ret; 308 return ret;
309 ret = psm_adjust_power_state_dynamic(hwmgr, false, requested_ps); 309 ret = psm_adjust_power_state_dynamic(hwmgr, false, requested_ps);
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
index 7656324957a8..167cdc321db2 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
@@ -188,19 +188,19 @@ int psm_set_performance_states(struct pp_hwmgr *hwmgr)
188 188
189int psm_set_user_performance_state(struct pp_hwmgr *hwmgr, 189int psm_set_user_performance_state(struct pp_hwmgr *hwmgr,
190 enum PP_StateUILabel label_id, 190 enum PP_StateUILabel label_id,
191 struct pp_power_state *state) 191 struct pp_power_state **state)
192{ 192{
193 int table_entries; 193 int table_entries;
194 int i; 194 int i;
195 195
196 table_entries = hwmgr->num_ps; 196 table_entries = hwmgr->num_ps;
197 state = hwmgr->ps; 197 *state = hwmgr->ps;
198 198
199restart_search: 199restart_search:
200 for (i = 0; i < table_entries; i++) { 200 for (i = 0; i < table_entries; i++) {
201 if (state->classification.ui_label & label_id) 201 if ((*state)->classification.ui_label & label_id)
202 return 0; 202 return 0;
203 state = (struct pp_power_state *)((unsigned long)state + hwmgr->ps_size); 203 *state = (struct pp_power_state *)((uintptr_t)*state + hwmgr->ps_size);
204 } 204 }
205 205
206 switch (label_id) { 206 switch (label_id) {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h
index aa44e60ec1b6..fa1b6825036a 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.h
@@ -32,7 +32,7 @@ int psm_set_boot_states(struct pp_hwmgr *hwmgr);
32int psm_set_performance_states(struct pp_hwmgr *hwmgr); 32int psm_set_performance_states(struct pp_hwmgr *hwmgr);
33int psm_set_user_performance_state(struct pp_hwmgr *hwmgr, 33int psm_set_user_performance_state(struct pp_hwmgr *hwmgr,
34 enum PP_StateUILabel label_id, 34 enum PP_StateUILabel label_id,
35 struct pp_power_state *state); 35 struct pp_power_state **state);
36int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, 36int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr,
37 bool skip, 37 bool skip,
38 struct pp_power_state *new_ps); 38 struct pp_power_state *new_ps);