Blob Blame History Raw
From b2ae0c77ebcede752854b050b52f834facf8f173 Mon Sep 17 00:00:00 2001
From: Asher Song <Asher.Song@amd.com>
Date: Tue, 27 Sep 2022 15:22:53 +0800
Subject: drm/amdgpu: fix a compiling error in old kernels
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Git-commit: 9e447c811ab31cd69d8fff18283fb695e1ff59a5
Patch-mainline: v6.1-rc1
References: jsc#PED-1166 jsc#PED-1168 jsc#PED-1170 jsc#PED-1218 jsc#PED-1220 jsc#PED-1222 jsc#PED-1223 jsc#PED-1225 jsc#PED-2849

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++) {

Signed-off-by: Asher Song <Asher.Song@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Patrik Jakobsson <pjakobsson@suse.de>
---
 drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
index 28745e21b337..a750343ca521 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
@@ -1402,8 +1402,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.38.1