diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2013-08-20 19:09:54 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2013-08-30 16:31:22 -0400 |
commit | 9af37a7d4e195119ecfd570d02d17d4d159da912 (patch) | |
tree | 58c6cec915081160bc25b7e7b5cb2a11e89c9829 | |
parent | b309ed98672705729bce271efb60f530290bbffd (diff) |
drm/radeon: gcc fixes for kb/kv dpm
Newer versions of gcc seem to wander off into the
weeds when dealing with variable sizes arrays in
structs. Rather than indexing the arrays, use
pointer arithmetic.
See bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=66932
https://bugs.freedesktop.org/show_bug.cgi?id=66972
https://bugs.freedesktop.org/show_bug.cgi?id=66945
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/radeon/kv_dpm.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 15a6f67813d7..ecd60809db4e 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -2466,6 +2466,7 @@ static int kv_parse_power_table(struct radeon_device *rdev) | |||
2466 | rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime); | 2466 | rdev->pm.dpm.backbias_response_time = le16_to_cpu(power_info->pplib.usBackbiasTime); |
2467 | rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime); | 2467 | rdev->pm.dpm.voltage_response_time = le16_to_cpu(power_info->pplib.usVoltageTime); |
2468 | for (i = 0; i < state_array->ucNumEntries; i++) { | 2468 | for (i = 0; i < state_array->ucNumEntries; i++) { |
2469 | u8 *idx; | ||
2469 | power_state = (union pplib_power_state *)power_state_offset; | 2470 | power_state = (union pplib_power_state *)power_state_offset; |
2470 | non_clock_array_index = power_state->v2.nonClockInfoIndex; | 2471 | non_clock_array_index = power_state->v2.nonClockInfoIndex; |
2471 | non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) | 2472 | non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) |
@@ -2479,14 +2480,16 @@ static int kv_parse_power_table(struct radeon_device *rdev) | |||
2479 | } | 2480 | } |
2480 | rdev->pm.dpm.ps[i].ps_priv = ps; | 2481 | rdev->pm.dpm.ps[i].ps_priv = ps; |
2481 | k = 0; | 2482 | k = 0; |
2483 | idx = (u8 *)&power_state->v2.clockInfoIndex[0]; | ||
2482 | for (j = 0; j < power_state->v2.ucNumDPMLevels; j++) { | 2484 | for (j = 0; j < power_state->v2.ucNumDPMLevels; j++) { |
2483 | clock_array_index = power_state->v2.clockInfoIndex[j]; | 2485 | clock_array_index = idx[j]; |
2484 | if (clock_array_index >= clock_info_array->ucNumEntries) | 2486 | if (clock_array_index >= clock_info_array->ucNumEntries) |
2485 | continue; | 2487 | continue; |
2486 | if (k >= SUMO_MAX_HARDWARE_POWERLEVELS) | 2488 | if (k >= SUMO_MAX_HARDWARE_POWERLEVELS) |
2487 | break; | 2489 | break; |
2488 | clock_info = (union pplib_clock_info *) | 2490 | clock_info = (union pplib_clock_info *) |
2489 | &clock_info_array->clockInfo[clock_array_index * clock_info_array->ucEntrySize]; | 2491 | ((u8 *)&clock_info_array->clockInfo[0] + |
2492 | (clock_array_index * clock_info_array->ucEntrySize)); | ||
2490 | kv_parse_pplib_clock_info(rdev, | 2493 | kv_parse_pplib_clock_info(rdev, |
2491 | &rdev->pm.dpm.ps[i], k, | 2494 | &rdev->pm.dpm.ps[i], k, |
2492 | clock_info); | 2495 | clock_info); |