Skip to contentSkip to conversation

drm/amd/display: optimize code runtime a bit

PATCH Superseded Bernard Zhao 2 participants 3 messages Sep 21, 2020 – Sep 22, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: optimize code runtime a bit

Static function dal_ddc_i2c_payloads_destroy is only called in dal_ddc_service_query_ddc_data, the parameter is &payloads , there is no point NULL risk, so no need to check. This change is to make the code run a bit fast.

---
 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c +0 -3
index b984eecca58b..6dcc666738fc 100644
@@ -150,9 +150,6 @@ static uint32_t dal_ddc_i2c_payloads_get_count(struct i2c_payloads *p)
 
 static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads *p)
 {
-	if (!p)
-		return;
-
 	dal_vector_destruct(&p->payloads);
 }
 
Signature · 1 line
2.28.0
#1 lore raw
Quoted 6 lines · Bernard Zhao

Static function dal_ddc_i2c_payloads_destroy is only called in dal_ddc_service_query_ddc_data, the parameter is &payloads , there is no point NULL risk, so no need to check. This change is to make the code run a bit fast.

How about just getting rid of dal_ddc_i2c_payloads_destroy() and just call dal_vector_destruct() directly.

Alex

Quoted 22 lines
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c +0 -4
index b984eecca58b..6dcc666738fc 100644
@@ -150,9 +150,6 @@ static uint32_t dal_ddc_i2c_payloads_get_count(struct i2c_payloads *p)
 
 static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads *p)
 {
-       if (!p)
-               return;
-
        dal_vector_destruct(&p->payloads);
 }
 
--

2.28.0

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

author
#2 lore raw

From: Alex Deucher <[email protected]>
Date: 2020-09-22 03:33:20
To: Bernard Zhao <[email protected]>
Cc: Harry Wentland <[email protected]>,Leo Li <[email protected]>,Alex Deucher <[email protected]>,"Christian König" <[email protected]>,David Airlie <[email protected]>,Daniel Vetter <[email protected]>,Rodrigo Siqueira <[email protected]>,Jun Lei <[email protected]>,Aric Cyr <[email protected]>,Wenjing Liu <[email protected]>,abdoulaye berthe <[email protected]>,Michael Strauss <[email protected]>,Brandon Syu <[email protected]>,Martin Leung <[email protected]>,amd-gfx list <[email protected]>,Maling list - DRI developers <[email protected]>,LKML <[email protected]>,[email protected]

Quoted 9 lines · Bernard Zhao
Quoted 6 lines

Static function dal_ddc_i2c_payloads_destroy is only called in dal_ddc_service_query_ddc_data, the parameter is &payloads , there is no point NULL risk, so no need to check. This change is to make the code run a bit fast.

How about just getting rid of dal_ddc_i2c_payloads_destroy() and just call dal_vector_destruct() directly.

Good idea, I will resubmit a patch, thanks!

BR//Bernard

Quoted 29 lines

Alex

Quoted 26 lines
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c +0 -4
index b984eecca58b..6dcc666738fc 100644
@@ -150,9 +150,6 @@ static uint32_t dal_ddc_i2c_payloads_get_count(struct i2c_payloads *p)
 
 static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads *p)
 {
-       if (!p)
-               return;
-
        dal_vector_destruct(&p->payloads);
 }
 
--

2.28.0

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