drm/amd: fix compilation issue with legacy gcc
PATCH 1/1 drm/amd: fix compilation issue with legacy gcc
This patch is used to fix following compilation issue with legacy gcc
error: ‘for’ loop initial declarations are only allowed in C99 mode
--- .../drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c | 9 ++++++--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 7 ++++--- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +6 -3
@@ -137,8 +137,9 @@ static uint8_t get_lowest_dpia_index(struct dc_link *link) {const struct dc *dc_struct = link->dc;uint8_t idx =0xFF ; +int i; -for (int i =0 ; i <MAX_PIPES *2 ; ++i) { +for (i =0 ; i <MAX_PIPES *2 ; ++i) {if (!dc_struct->links[i] || dc_struct->links[i]->ep_type !=DISPLAY_ENDPOINT_USB4_DPIA )
@@ -165,8 +166,9 @@ static int get_host_router_total_bw(struct dc_link *link, uint8_t type)uint8_t idx = (link->link_index - lowest_dpia_index) /2 , idx_temp =0 ;struct dc_link *link_temp;int total_bw =0 ; +int i; -for (int i =0 ; i <MAX_PIPES *2 ; ++i) { +for (i =0 ; i <MAX_PIPES *2 ; ++i) {if (!dc_struct->links[i] || dc_struct->links[i]->ep_type !=DISPLAY_ENDPOINT_USB4_DPIA )continue ;
@@ -467,12 +469,13 @@ bool dpia_validate_usb4_bw(struct dc_link **link, int *bw_needed_per_dpia, uint8bool ret = true;int bw_needed_per_hr[MAX_HR_NUM ] = {0 ,0 };uint8_t lowest_dpia_index =0 , dpia_index =0 ; +uint8_t i;if (!num_dpias || num_dpias >MAX_DPIA_NUM )return ret;//Get total Host Router BW & Validate against each Host Router max BW -for (uint8_t i =0 ; i < num_dpias; ++i) { +for (i =0 ; i < num_dpias; ++i) {if (!link[i]->dpia_bw_alloc_config.bw_alloc_enabled)continue ;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +4 -3
@@ -325,6 +325,7 @@ static int smu_v13_0_6_setup_driver_pptable(struct smu_context *smu)struct PPTable_t *pptable = (struct PPTable_t *)smu_table->driver_pptable;int ret; +int i;/* Store one-time values in driver PPTable */ if (!pptable->Init) {
@@ -339,7 +340,7 @@ static int smu_v13_0_6_setup_driver_pptable(struct smu_context *smu) pptable->MinGfxclkFrequency =SMUQ10_TO_UINT (metrics->MinGfxclkFrequency); -for (int i =0 ; i <4 ; ++i) { +for (i =0 ; i <4 ; ++i) { pptable->FclkFrequencyTable[i] =SMUQ10_TO_UINT (metrics->FclkFrequencyTable[i]); pptable->UclkFrequencyTable[i] =
@@ -466,7 +467,7 @@ static int smu_v13_0_6_set_default_dpm_table(struct smu_context *smu)struct PPTable_t *pptable = (struct PPTable_t *)smu_table->driver_pptable;uint32_t gfxclkmin, gfxclkmax, levels; -int ret =0 , i; +int ret =0 , i, j;struct smu_v13_0_6_dpm_map dpm_map[] = { {SMU_SOCCLK ,SMU_FEATURE_DPM_SOCCLK_BIT , &dpm_context->dpm_tables.soc_table,
@@ -513,7 +514,7 @@ static int smu_v13_0_6_set_default_dpm_table(struct smu_context *smu) dpm_table->max = dpm_table->dpm_levels[0 ].value; } -for (int j =0 ; j <ARRAY_SIZE (dpm_map); j++) { +for (j =0 ; j <ARRAY_SIZE (dpm_map); j++) { dpm_table = dpm_map[j].dpm_table; levels =1 ;if (smu_cmn_feature_is_enabled (smu, dpm_map[j].feature_num)) {
Signature · 1 line
2.34.1
Quoted 114 lines
-----Original Message-----
From: bobzhou <[email protected]>
Sent: Wednesday, March 15, 2023 3:29 PM
To: [email protected]; Chen, Guchun <[email protected]>; Cui, Flora <[email protected]>; Shi, Leslie <[email protected]>; Ma, Jun <[email protected]>
Cc: Zhou, Bob <[email protected]>
Subject: [PATCH] drm/amd: fix compilation issue with legacy gccThis patch is used to fix following compilation issue with legacy gcc
error: ‘for’ loop initial declarations are only allowed in C99 mode
Signed-off-by bobzhou <[email protected]>--- .../drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c | 9 ++++++--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 7 ++++--- 2 files changed, 10 insertions(+), 6 deletions(-)diff --git
a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.cb/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.cindex2e251dcbb022..931f7c6446de100644drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +2
-1@@ -137,8 +137,9 @@ static uint8_t get_lowest_dpia_index(struct dc_link *link) { const struct dc *dc_struct = link->dc; uint8_t idx = 0xFF; + int i; - for (int i = 0; i < MAX_PIPES * 2; ++i) { + for (i = 0; i < MAX_PIPES * 2; ++i) { if (!dc_struct->links[i] || dc_struct->links[i]->ep_type !=
DISPLAY_ENDPOINT_USB4_DPIA) @@ -165,8 +166,9 @@ static intget_host_router_total_bw(struct dc_link *link, uint8_t type)drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +2
-1uint8_t idx = (link->link_index - lowest_dpia_index) /2 , idx_temp =0 ;struct dc_link *link_temp;int total_bw =0 ; +int i; - for (int i = 0; i < MAX_PIPES * 2; ++i) { + for (i = 0; i < MAX_PIPES * 2; ++i) { if (!dc_struct->links[i] || dc_struct->links[i]->ep_type !=
DISPLAY_ENDPOINT_USB4_DPIA)drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +0
-0continue ;@@ -467,12 +469,13 @@ bool dpia_validate_usb4_bw(struct dc_link **link,int
*bw_needed_per_dpia, uint8drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +1
-0bool ret = true;int bw_needed_per_hr[MAX_HR_NUM ] = {0 ,0 };uint8_t lowest_dpia_index =0 , dpia_index =0 ; +uint8_t i;if (!num_dpias || num_dpias >MAX_DPIA_NUM )return ret;//Get total Host Router BW & Validate against each Host Router max BW
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +1
-1-for (uint8_t i =0 ; i < num_dpias; ++i) { +for (i =0 ; i < num_dpias; ++i) {if (!link[i]->dpia_bw_alloc_config.bw_alloc_enabled)continue ;drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1
-0@@ -325,6 +325,7 @@ static int smu_v13_0_6_setup_driver_pptable(struct smu_context *smu)struct PPTable_t *pptable = (struct PPTable_t *)smu_table->driver_pptable;int ret; +int i;/* Store one-time values in driver PPTable */ drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1
-1if (!pptable->Init) {@@ -339,7 +340,7 @@ static int smu_v13_0_6_setup_driver_pptable(struct smu_context *smu) pptable->MinGfxclkFrequency =SMUQ10_TO_UINT (metrics->MinGfxclkFrequency); -for (int i =0 ; i <4 ; ++i) { +for (i =0 ; i <4 ; ++i) { pptable->FclkFrequencyTable[i] = SMUQ10_TO_UINT(metrics-Quoted 1 line
FclkFrequencyTable[i]);
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1
-1pptable->UclkFrequencyTable[i] =@@ -466,7 +467,7 @@ static int smu_v13_0_6_set_default_dpm_table(struct smu_context *smu) struct PPTable_t *pptable = (struct PPTable_t *)smu_table->driver_pptable;uint32_t gfxclkmin, gfxclkmax, levels; -int ret =0 , i; +int ret =0 , i, j;struct smu_v13_0_6_dpm_map dpm_map[] = { {SMU_SOCCLK ,SMU_FEATURE_DPM_SOCCLK_BIT ,drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1
-1&dpm_context->dpm_tables.soc_table,@@ -513,7 +514,7 @@ static int smu_v13_0_6_set_default_dpm_table(struct smu_context *smu) dpm_table->max = dpm_table->dpm_levels[0].value; } -for (int j =0 ; j <ARRAY_SIZE (dpm_map); j++) { +for (j =0 ; j <ARRAY_SIZE (dpm_map); j++) { dpm_table = dpm_map[j].dpm_table; levels =1 ;if (smu_cmn_feature_is_enabled(smu,
dpm_map[j].feature_num)) {
--
2.34.1