From: "Nuno Sá via B4 Relay" <devnull+nuno.sa.analog.com@kernel.org>
To: linux-clk@vger.kernel.org, linux-fpga@vger.kernel.org
Cc: Stephen Boyd <sboyd@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Moritz Fischer <mdf@kernel.org>, Wu Hao <hao.wu@intel.com>,
Xu Yilun <yilun.xu@intel.com>, Tom Rix <trix@redhat.com>
Subject: [PATCH v3 5/6] clk: clk-axi-clkgen move to min/max()
Date: Mon, 07 Apr 2025 11:28:19 +0100 [thread overview]
Message-ID: <20250407-dev-axi-clkgen-limits-v3-5-33c7f27c9d69@analog.com> (raw)
In-Reply-To: <20250407-dev-axi-clkgen-limits-v3-0-33c7f27c9d69@analog.com>
From: Nuno Sá <nuno.sa@analog.com>
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>
---
drivers/clk/clk-axi-clkgen.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c
index 8c270ba7626bc24c4385615b7aa08ee95e198881..82a99c3b9063cd2dd8a9dc7fdec81a38feee12b9 100644
--- a/drivers/clk/clk-axi-clkgen.c
+++ b/drivers/clk/clk-axi-clkgen.c
@@ -144,15 +144,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));
--
2.49.0
next prev parent reply other threads:[~2025-04-07 10:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 10:28 [PATCH v3 0/6] clk: clk-axi-clkgen: improvements and some fixes Nuno Sá via B4 Relay
2025-04-07 10:28 ` [PATCH v3 1/6] clk: clk-axi-clkgen: fix fpfd_max frequency for zynq Nuno Sá via B4 Relay
2025-04-07 10:28 ` [PATCH v3 2/6] clk: clk-axi-clkgen: make sure to include mod_devicetable.h Nuno Sá via B4 Relay
2025-04-07 10:28 ` [PATCH v3 3/6] include: fpga: adi-axi-common: add new helper macros Nuno Sá via B4 Relay
2025-04-07 10:28 ` [PATCH v3 4/6] clk: clk-axi-clkgen: detect axi_clkgen_limits at runtime Nuno Sá via B4 Relay
2025-04-07 10:28 ` Nuno Sá via B4 Relay [this message]
2025-04-07 10:28 ` [PATCH v3 6/6] clk: clk-axi-clkgen: fix coding style issues Nuno Sá via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250407-dev-axi-clkgen-limits-v3-5-33c7f27c9d69@analog.com \
--to=devnull+nuno.sa.analog.com@kernel.org \
--cc=hao.wu@intel.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-fpga@vger.kernel.org \
--cc=mdf@kernel.org \
--cc=mturquette@baylibre.com \
--cc=nuno.sa@analog.com \
--cc=sboyd@kernel.org \
--cc=trix@redhat.com \
--cc=yilun.xu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).