Skip to contentSkip to conversation

drm/amdgpu: fix a compiling error in old kernels

PATCH In review Asher Song 3 participants 3 messages Sep 27, 2022

Subsystems (3)
lore
Share & tools
lore

Asher Song

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix a compiling error in old kernels

This patch is used to fix following compiling error that occurs in some old kernels.

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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +2 -1
index 772ad200c5da..c91fcde7a16c 100644
@@ -1405,8 +1405,9 @@ void dcn32_update_dsc_pg(struct dc *dc,
 		bool safe_to_disable)
 {
 	struct dce_hwseq *hws = dc->hwseq;
+	int i;
 
-	for (int i = 0; i < dc->res_pool->res_cap->num_dsc; 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
Reviewed-by on v1 1/1
#1 lore raw

Regards,
Guchun

-----Original Message-----
From: Song, Asher <[email protected]>
Sent: Tuesday, September 27, 2022 11:38 AM
To: Chen, Guchun <[email protected]>; Cui, Flora <[email protected]>; Shi, Leslie <[email protected]>; Ma, Jun <[email protected]>; [email protected]
Cc: Song, Asher <[email protected]>
Subject: [PATCH] drm/amdgpu: fix a compiling error in old kernels

This patch is used to fix following compiling error that occurs in some old kernels.

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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +2 -1
index 772ad200c5da..c91fcde7a16c 100644
@@ -1405,8 +1405,9 @@ void dcn32_update_dsc_pg(struct dc *dc,
 		bool safe_to_disable)
 {
 	struct dce_hwseq *hws = dc->hwseq;
+	int i;
 
-	for (int i = 0; i < dc->res_pool->res_cap->num_dsc; 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);
 

--
2.25.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Asher Song

Am 27.09.22 um 05:37 schrieb Asher Song:

Quoted 7 lines

This patch is used to fix following compiling error that occurs in some old kernels.

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

Quoted 19 lines
---
  drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +2 -1
index 772ad200c5da..c91fcde7a16c 100644
@@ -1405,8 +1405,9 @@ void dcn32_update_dsc_pg(struct dc *dc,
  		bool safe_to_disable)
  {
  	struct dce_hwseq *hws = dc->hwseq;
+	int i;
 
-	for (int i = 0; i < dc->res_pool->res_cap->num_dsc; 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);