Skip to content

Commit 3ed741d

Browse files
larsclausenbebarino
authored andcommitted
clk: vc5: Use clamp() to restrict PLL range
The VCO frequency needs to be within a certain range and the driver enforces this. Make use of the clamp macro to implement this instead of open-coding it. This makes the code a bit shorter and also semanticly stronger. Signed-off-by: Lars-Peter Clausen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Luca Ceresoli <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 1b929c0 commit 3ed741d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/clk/clk-versaclock5.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,7 @@ static long vc5_pll_round_rate(struct clk_hw *hw, unsigned long rate,
449449
u32 div_int;
450450
u64 div_frc;
451451

452-
if (rate < VC5_PLL_VCO_MIN)
453-
rate = VC5_PLL_VCO_MIN;
454-
if (rate > VC5_PLL_VCO_MAX)
455-
rate = VC5_PLL_VCO_MAX;
452+
rate = clamp(rate, VC5_PLL_VCO_MIN, VC5_PLL_VCO_MAX);
456453

457454
/* Determine integer part, which is 12 bit wide */
458455
div_int = rate / *parent_rate;

0 commit comments

Comments
 (0)