]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
clk: clk-axi-clkgen move to min/max()
authorNuno Sá <nuno.sa@analog.com>
Mon, 19 May 2025 15:41:11 +0000 (16:41 +0100)
committerStephen Boyd <sboyd@kernel.org>
Tue, 1 Jul 2025 00:57:34 +0000 (17:57 -0700)
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>
drivers/clk/clk-axi-clkgen.c

index f4e96394e9c25c817b09ee0c08751147083f19b7..63951209c460f26ed3940879da536e31ae530188 100644 (file)
@@ -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));