]> git.baikalelectronics.ru Git - kernel.git/commit
clk: Use clamp instead of open-coding our own
authorMaxime Ripard <maxime@cerno.tech>
Fri, 25 Feb 2022 14:35:27 +0000 (15:35 +0100)
committerStephen Boyd <sboyd@kernel.org>
Sat, 12 Mar 2022 03:14:40 +0000 (19:14 -0800)
commit2a2801910a7ca0194f0ce5e086a7d292578994e9
tree81fddac32910fd317a01d8f12585ae0157c2af20
parenta21487acb9eff5cffaa6dcbdba7c41f735cd902a
clk: Use clamp instead of open-coding our own

The code in clk_set_rate_range() will, if the current rate is outside of
the new range, force it to the minimum or maximum.

Since it's running under the condition that the rate is either lower
than the minimum, or higher than the maximum, this is equivalent to
using clamp, while being less readable. Let's switch to using clamp
instead.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220225143534.405820-6-maxime@cerno.tech
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/clk.c