Message ID | 20240830012344.603704-1-lizetao1@huawei.com |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | [-next] clk: tegra: use clamp() in tegra_bpmp_clk_determine_rate() | expand |
On Fri, Aug 30, 2024 at 09:23:44AM +0800, Li Zetao wrote: > When it needs to get a value within a certain interval, using clamp() > makes the code easier to understand than min(max()). > > Signed-off-by: Li Zetao <lizetao1@huawei.com> > --- > drivers/clk/tegra/clk-bpmp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Mike, Stephen, can you pick this up directly? I haven't had any other clock patches in a while. If so: Acked-by: Thierry Reding <treding@nvidia.com> If you'd like me to send a pull request, let me know. Thanks, Thierry
Quoting Li Zetao (2024-08-29 18:23:44) > When it needs to get a value within a certain interval, using clamp() > makes the code easier to understand than min(max()). > > Signed-off-by: Li Zetao <lizetao1@huawei.com> > --- Applied to clk-next
diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c index 7bfba0afd778..b2323cb8eddc 100644 --- a/drivers/clk/tegra/clk-bpmp.c +++ b/drivers/clk/tegra/clk-bpmp.c @@ -174,7 +174,7 @@ static int tegra_bpmp_clk_determine_rate(struct clk_hw *hw, unsigned long rate; int err; - rate = min(max(rate_req->rate, rate_req->min_rate), rate_req->max_rate); + rate = clamp(rate_req->rate, rate_req->min_rate, rate_req->max_rate); memset(&request, 0, sizeof(request)); request.rate = min_t(u64, rate, S64_MAX);
When it needs to get a value within a certain interval, using clamp() makes the code easier to understand than min(max()). Signed-off-by: Li Zetao <lizetao1@huawei.com> --- drivers/clk/tegra/clk-bpmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)