1 From 6e08e0fa4ba16546fdbb2cdcc4ee6483bd0a6956 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Mon, 17 Jan 2022 16:43:52 +0100
4 Subject: [PATCH] clk: Add clk_drop_range
6 In order to reset the range on a clock, we need to call
7 clk_set_rate_range with a minimum of 0 and a maximum of ULONG_MAX. Since
8 it's fairly inconvenient, let's introduce a clk_drop_range() function
9 that will do just this.
11 Suggested-by: Stephen Boyd <sboyd@kernel.org>
12 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
14 drivers/clk/clk_test.c | 4 ++--
15 include/linux/clk.h | 11 +++++++++++
16 2 files changed, 13 insertions(+), 2 deletions(-)
18 --- a/drivers/clk/clk_test.c
19 +++ b/drivers/clk/clk_test.c
20 @@ -645,7 +645,7 @@ static void clk_range_test_multiple_set_
21 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1);
24 - clk_set_rate_range(user2, 0, ULONG_MAX),
25 + clk_drop_range(user2),
28 rate = clk_get_rate(clk);
29 @@ -762,7 +762,7 @@ static void clk_range_test_multiple_set_
30 KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2);
33 - clk_set_rate_range(user2, 0, ULONG_MAX),
34 + clk_drop_range(user2),
37 rate = clk_get_rate(clk);
38 --- a/include/linux/clk.h
39 +++ b/include/linux/clk.h
40 @@ -987,6 +987,17 @@ static inline void clk_bulk_disable_unpr
44 + * clk_drop_range - Reset any range set on that clock
45 + * @clk: clock source
47 + * Returns success (0) or negative errno.
49 +static inline int clk_drop_range(struct clk *clk)
51 + return clk_set_rate_range(clk, 0, ULONG_MAX);
55 * clk_get_optional - lookup and obtain a reference to an optional clock
57 * @dev: device for clock "consumer"