Skip to contentSkip to conversation

drm/amd/display: Fix wrongly passed static prefix

PATCH In review Takashi Iwai 4 participants 4 messages Nov 28, 2019 – Feb 5, 2020 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: Fix wrongly passed static prefix

Currently, gcc spews a warning as:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_hubbub.c: In function ‘hubbub1_verify_allow_pstate_change_high’:
./include/drm/drm_print.h:316:2: warning: ‘debug_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]

This is because the code checks against a static value although it's basically a constant and guaranteed to be set.

This patch changes the type prefix from static to const for addressing the compile warning above and also for letting the compiler optimize better.

Fixes 62d591a8e00c ("drm/amd/display: create new files for hubbub functions")
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c +2 -2
index a02c10e23e0d..b5c44c3bdb98 100644
@@ -128,8 +128,8 @@ bool hubbub1_verify_allow_pstate_change_high(
 	 * pstate takes around ~100us on linux. Unknown currently as to
 	 * why it takes that long on linux
 	 */
-	static unsigned int pstate_wait_timeout_us = 200;
-	static unsigned int pstate_wait_expected_timeout_us = 40;
+	const unsigned int pstate_wait_timeout_us = 200;
+	const unsigned int pstate_wait_expected_timeout_us = 40;
 	static unsigned int max_sampled_pstate_wait_us; /* data collection */
 	static bool forced_pstate_allow; /* help with revert wa */
 
Signature · 6 lines
2.16.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#2 lore raw
Quoted 7 lines · Takashi Iwai

Currently, gcc spews a warning as:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_hubbub.c: In function ‘hubbub1_verify_allow_pstate_change_high’:
./include/drm/drm_print.h:316:2: warning: ‘debug_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]

This is because the code checks against a static value although it's basically a constant and guaranteed to be set.

Quoted 6 lines

This patch changes the type prefix from static to const for addressing the compile warning above and also for letting the compiler optimize better.

Fixes 62d591a8e00c ("drm/amd/display: create new files for hubbub functions")

Harry

Quoted 10 lines
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c +0 -0
index a02c10e23e0d..b5c44c3bdb98 100644

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c bool hubbub1_verify_allow_pstate_change_high( · line 135

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c +2 -2
@@ -128,8 +128,8 @@ bool hubbub1_verify_allow_pstate_change_high(
 	 * pstate takes around ~100us on linux. Unknown currently as to
 	 * why it takes that long on linux
 	 */
-	static unsigned int pstate_wait_timeout_us = 200;
-	static unsigned int pstate_wait_expected_timeout_us = 40;
+	const unsigned int pstate_wait_timeout_us = 200;
+	const unsigned int pstate_wait_expected_timeout_us = 40;
 	static unsigned int max_sampled_pstate_wait_us; /* data collection */
 	static bool forced_pstate_allow; /* help with revert wa */
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
Quoted 13 lines · Harry Wentland
Quoted 11 lines · Takashi Iwai

Currently, gcc spews a warning as:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_hubbub.c: In function ‘hubbub1_verify_allow_pstate_change_high’:
./include/drm/drm_print.h:316:2: warning: ‘debug_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]

This is because the code checks against a static value although it's basically a constant and guaranteed to be set.

This patch changes the type prefix from static to const for addressing the compile warning above and also for letting the compiler optimize better.

Quoted 6 lines
Quoted 2 lines
Fixes 62d591a8e00c ("drm/amd/display: create new files for hubbub functions")

Harry

This patch seems forgotten? The compile warning is still present in the latest for-next.

thanks,

Takashi

Quoted 5 lines
Quoted 5 lines
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 17 lines
Quoted 6 lines
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c +0 -0
index a02c10e23e0d..b5c44c3bdb98 100644

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c bool hubbub1_verify_allow_pstate_change_high( · line 135

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c +2 -2
@@ -128,8 +128,8 @@ bool hubbub1_verify_allow_pstate_change_high(
 	 * pstate takes around ~100us on linux. Unknown currently as to
 	 * why it takes that long on linux
 	 */
-	static unsigned int pstate_wait_timeout_us = 200;
-	static unsigned int pstate_wait_expected_timeout_us = 40;
+	const unsigned int pstate_wait_timeout_us = 200;
+	const unsigned int pstate_wait_expected_timeout_us = 40;
 	static unsigned int max_sampled_pstate_wait_us; /* data collection */
 	static bool forced_pstate_allow; /* help with revert wa */
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw
Quoted 19 lines · Takashi Iwai
Quoted 16 lines · Harry Wentland
Quoted 13 lines · Takashi Iwai

Currently, gcc spews a warning as:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_hubbub.c: In function ‘hubbub1_verify_allow_pstate_change_high’:
./include/drm/drm_print.h:316:2: warning: ‘debug_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]

This is because the code checks against a static value although it's basically a constant and guaranteed to be set.

This patch changes the type prefix from static to const for addressing the compile warning above and also for letting the compiler optimize better.

Fixes 62d591a8e00c ("drm/amd/display: create new files for hubbub functions")
Quoted 7 lines
Quoted 3 lines

Harry

This patch seems forgotten? The compile warning is still present in the latest for-next.

Sorry, totally missed this one. Applied.

Alex

Quoted 27 lines

thanks,

Takashi

Quoted 5 lines
Quoted 5 lines
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 17 lines
Quoted 6 lines
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c +0 -0
index a02c10e23e0d..b5c44c3bdb98 100644

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c bool hubbub1_verify_allow_pstate_change_high( · line 135

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c +2 -2
@@ -128,8 +128,8 @@ bool hubbub1_verify_allow_pstate_change_high(
     * pstate takes around ~100us on linux. Unknown currently as to
     * why it takes that long on linux
     */
-   static unsigned int pstate_wait_timeout_us = 200;
-   static unsigned int pstate_wait_expected_timeout_us = 40;
+   const unsigned int pstate_wait_timeout_us = 200;
+   const unsigned int pstate_wait_expected_timeout_us = 40;
    static unsigned int max_sampled_pstate_wait_us; /* data collection */
    static bool forced_pstate_allow; /* help with revert wa */
 
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx