Skip to contentSkip to conversation

drm/amdgpu: fix a compiling error

PATCH In review Asher Song 2 participants 2 messages Sep 26, 2022

Subsystems (3)
lore
Share & tools
lore

Asher Song

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix a compiling error

The patch fix following compiling error:

error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int i = 0; i < dc->res_pool->res_cap->num_dsc; i++) {

---
 drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +2 -2
index 772ad200c5da..d58c5085600a 100644
@@ -1405,8 +1405,8 @@ void dcn32_update_dsc_pg(struct dc *dc,
 		bool safe_to_disable)
 {
 	struct dce_hwseq *hws = dc->hwseq;
-
-	for (int i = 0; i < dc->res_pool->res_cap->num_dsc; i++) {
+	int i;
+	for (i = 0; i < dc->res_pool->res_cap->num_dsc; i++) {
 		struct display_stream_compressor *dsc = dc->res_pool->dscs[i];
 		bool is_dsc_ungated = hws->funcs.dsc_pg_status(hws, dsc->inst);
 
Signature · 1 line
2.25.1
maintainer
#1 lore raw

Am 26.09.22 um 11:22 schrieb Asher Song:

Quoted 4 lines

The patch fix following compiling error:

error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int i = 0; i < dc->res_pool->res_cap->num_dsc; i++) {

Newer kernels are compiled in C99 mode, so this in now legal.

We should probably still fix that issue since we often port back things to older kernels.

Quoted 11 lines
---
  drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +0 -0
index 772ad200c5da..d58c5085600a 100644

drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c void dcn32_update_dsc_pg(struct dc *dc, · line 1409

Quoted 7 lines
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +2 -2
@@ -1405,8 +1405,8 @@ void dcn32_update_dsc_pg(struct dc *dc,
  		bool safe_to_disable)
  {
  	struct dce_hwseq *hws = dc->hwseq;
-
-	for (int i = 0; i < dc->res_pool->res_cap->num_dsc; i++) {
+	int i;
+	for (i = 0; i < dc->res_pool->res_cap->num_dsc; i++) {

An empty line is required between deceleration and code. Try to use checkpatch.pl before sending out the patch.

Regards,
Christian.

Quoted 3 lines
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +0 -0
  		struct display_stream_compressor *dsc = dc->res_pool->dscs[i];
  		bool is_dsc_ungated = hws->funcs.dsc_pg_status(hws, dsc->inst);