drm/radeon: Simplify maximum determination in radeon_uvd_calc_upll_dividers()
Subsystems (3)
PATCH 1/1 drm/radeon: Simplify maximum determination in radeon_uvd_calc_upll_dividers()
From: Markus Elfring <[email protected]>
Date: Fri, 28 Feb 2025 17:32:45 +0100
Replace nested max() calls by single max3() call in this function implementation.
This issue was transformed by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
--- drivers/gpu/drm/radeon/radeon_uvd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_uvd.c +1 -1
@@ -961,7 +961,7 @@ int radeon_uvd_calc_upll_dividers(struct radeon_device *rdev,unsigned optimal_score = ~0 ;/* loop through vco from low to high */ - vco_min =max (max (vco_min, vclk), dclk); + vco_min =max3 (vco_min, vclk, dclk);for (vco_freq = vco_min; vco_freq <= vco_max; vco_freq +=100 ) {uint64_t fb_div = (uint64_t )vco_freq * fb_factor;
--
2.48.1
Quoted 7 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 28 Feb 2025 17:32:45 +0100Replace nested
max()calls by singlemax3()call in this function implementation.This issue was transformed by using the Coccinelle software.
How about something like "this change was made" or "this code was transformed"? Coccinelle didn't transform the issue, it transformed the code to solve the issue.
Cheers,
Natalie
Quoted 22 lines
Signed-off-by Markus Elfring <[email protected]>--- drivers/gpu/drm/radeon/radeon_uvd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/radeon/radeon_uvd.c +1
-2@@ -961,7 +961,7 @@ int radeon_uvd_calc_upll_dividers(struct radeon_device *rdev,unsigned optimal_score = ~0 ;/* loop through vco from low to high */ - vco_min =max (max (vco_min, vclk), dclk); + vco_min =max3 (vco_min, vclk, dclk);for (vco_freq = vco_min; vco_freq <= vco_max; vco_freq +=100 ) {uint64_t fb_div = (uint64_t )vco_freq * fb_factor; --2.48.1