* [PATCH] drm/amd/display: replace ternary operator with max()
@ 2022-10-29 15:19 wangkailong
0 siblings, 0 replies; 2+ messages in thread
From: wangkailong @ 2022-10-29 15:19 UTC (permalink / raw)
To: harry.wentland, sunpeng.li, airlied, daniel, HaoPing.Liu,
nicholas.kazlauskas
Cc: mario.limonciello, amd-gfx, dri-devel, linux-kernel
Fix the following coccicheck warning:
dcn20_clk_mgr.c:314:WARNING opportunity for max()
dcn20_clk_mgr.c:351:WARNING opportunity for max()
Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c
index 650f3b4b562e..1aecdc5f73b6 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c
@@ -311,7 +311,7 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base,
new_clocks->disp_dpp_voltage_level_khz = new_clocks->dppclk_khz;
if (update_dispclk)
- new_clocks->disp_dpp_voltage_level_khz = new_clocks->dispclk_khz > new_clocks->dppclk_khz ? new_clocks->dispclk_khz : new_clocks->dppclk_khz;
+ new_clocks->disp_dpp_voltage_level_khz = max(new_clocks->dispclk_khz, new_clocks->dppclk_khz);
clk_mgr_base->clks.disp_dpp_voltage_level_khz = new_clocks->disp_dpp_voltage_level_khz;
if (pp_smu && pp_smu->set_voltage_by_freq)
@@ -348,7 +348,7 @@ void dcn2_update_clocks_fpga(struct clk_mgr *clk_mgr,
struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;
/* Min fclk = 1.2GHz since all the extra scemi logic seems to run off of it */
- int fclk_adj = new_clocks->fclk_khz > 1200000 ? new_clocks->fclk_khz : 1200000;
+ int fclk_adj = max(new_clocks->fclk_khz, 1200000);
if (should_set_clock(safe_to_lower, new_clocks->phyclk_khz, clk_mgr->clks.phyclk_khz)) {
clk_mgr->clks.phyclk_khz = new_clocks->phyclk_khz;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH] drm/amd/display: replace ternary operator with max()
@ 2022-10-29 15:56 wangkailong
0 siblings, 0 replies; 2+ messages in thread
From: wangkailong @ 2022-10-29 15:56 UTC (permalink / raw)
To: harry.wentland, daniel, sunpeng.li, Rodrigo.Siqueira,
alexander.deucher, christian.koenig, airlied, jun.lei,
Alvin.Lee2, Nevenko.Stupar, samson.tam
Cc: rdunlap, David.Galiffi, amd-gfx, dri-devel, linux-kernel
Fix the following coccicheck warning:
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c:887:49-50:
WARNING opportunity for max()
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c:978:42-43:
WARNING opportunity for max()
Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
index b6cd10f3181c..5fdbbdca97e0 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
@@ -884,7 +884,7 @@ static bool subvp_drr_schedulable(struct dc *dc, struct dc_state *context, struc
stretched_drr_us = drr_frame_us + mall_region_us + SUBVP_DRR_MARGIN_US;
drr_stretched_vblank_us = (drr_timing->v_total - drr_timing->v_addressable) * drr_timing->h_total /
(double)(drr_timing->pix_clk_100hz * 100) * 1000000 + (stretched_drr_us - drr_frame_us);
- max_vblank_mallregion = drr_stretched_vblank_us > mall_region_us ? drr_stretched_vblank_us : mall_region_us;
+ max_vblank_mallregion = max(drr_stretched_vblank_us, mall_region_us);
/* We consider SubVP + DRR schedulable if the stretched frame duration of the DRR display (i.e. the
* highest refresh rate + margin that can support UCLK P-State switch) passes the static analysis
@@ -975,7 +975,7 @@ static bool subvp_vblank_schedulable(struct dc *dc, struct dc_state *context)
(double)(vblank_timing->pix_clk_100hz * 100) * 1000000;
subvp_active_us = main_timing->v_addressable * main_timing->h_total /
(double)(main_timing->pix_clk_100hz * 100) * 1000000;
- max_vblank_mallregion = vblank_blank_us > mall_region_us ? vblank_blank_us : mall_region_us;
+ max_vblank_mallregion = max(vblank_blank_us, mall_region_us);
// Schedulable if VACTIVE region of the SubVP pipe can fit the MALL prefetch, VBLANK frame time,
// and the max of (VBLANK blanking time, MALL region)
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-29 16:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-29 15:19 [PATCH] drm/amd/display: replace ternary operator with max() wangkailong
2022-10-29 15:56 wangkailong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®