clk: clk-axi-clkgen move to min/max()
Instead of using the type versions of min/max(), use the plain ones as now they are perfectly capable of handling different types like unsigned and non negative integers that are compiletime constant. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250519-dev-axi-clkgen-limits-v6-6-bc4b3b61d1d4@analog.com Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
@@ -147,15 +147,15 @@ static void axi_clkgen_calc_params(const struct axi_clkgen_limits *limits,
|
||||
*best_m = 0;
|
||||
*best_dout = 0;
|
||||
|
||||
d_min = max_t(unsigned long, DIV_ROUND_UP(fin, limits->fpfd_max), 1);
|
||||
d_max = min_t(unsigned long, fin / limits->fpfd_min, 80);
|
||||
d_min = max(DIV_ROUND_UP(fin, limits->fpfd_max), 1);
|
||||
d_max = min(fin / limits->fpfd_min, 80);
|
||||
|
||||
again:
|
||||
fvco_min_fract = limits->fvco_min << fract_shift;
|
||||
fvco_max_fract = limits->fvco_max << fract_shift;
|
||||
|
||||
m_min = max_t(unsigned long, DIV_ROUND_UP(fvco_min_fract, fin) * d_min, 1);
|
||||
m_max = min_t(unsigned long, fvco_max_fract * d_max / fin, 64 << fract_shift);
|
||||
m_min = max(DIV_ROUND_UP(fvco_min_fract, fin) * d_min, 1);
|
||||
m_max = min(fvco_max_fract * d_max / fin, 64 << fract_shift);
|
||||
|
||||
for (m = m_min; m <= m_max; m++) {
|
||||
_d_min = max(d_min, DIV_ROUND_UP(fin * m, fvco_max_fract));
|
||||
|
||||
Reference in New Issue
Block a user