Re: [PATCH] drm/amdgpu: fix a compiling error in old kernels

2022-09-27 Thread Christian König

Am 27.09.22 um 05:37 schrieb Asher Song:

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 


Reviewed-by: Christian König 


---
  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 772ad200c5da..c91fcde7a16c 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
@@ -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);
  




RE: [PATCH] drm/amdgpu: fix a compiling error in old kernels

2022-09-26 Thread Chen, Guchun
Reviewed-by: Guchun Chen 

Regards,
Guchun

-Original Message-
From: Song, Asher  
Sent: Tuesday, September 27, 2022 11:38 AM
To: Chen, Guchun ; Cui, Flora ; Shi, 
Leslie ; Ma, Jun ; 
amd-gfx@lists.freedesktop.org
Cc: Song, Asher 
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++) {

Signed-off-by: Asher Song 
---
 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 772ad200c5da..c91fcde7a16c 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
@@ -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



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

2022-09-26 Thread Asher Song
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 
---
 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 772ad200c5da..c91fcde7a16c 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
@@ -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



Re: [PATCH] drm/amdgpu: fix a compiling error

2022-09-26 Thread Christian König

Am 26.09.22 um 11:22 schrieb Asher Song:

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.




Signed-off-by: Asher Song 
---
  drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

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 772ad200c5da..d58c5085600a 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
@@ -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.


struct display_stream_compressor *dsc = dc->res_pool->dscs[i];
bool is_dsc_ungated = hws->funcs.dsc_pg_status(hws, dsc->inst);
  




[PATCH] drm/amdgpu: fix a compiling error

2022-09-26 Thread Asher Song
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++) {

Signed-off-by: Asher Song 
---
 drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 772ad200c5da..d58c5085600a 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
@@ -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);
 
-- 
2.25.1