openwrt/target/linux/bcm27xx/patches-5.15/950-0835-clk-Add-clk_drop_range.patch
John Audia b6fa423907 kernel: bump 5.15 to 5.15.83
Removed upstreamed:
	backport-5.15/883-v6.1-ca8210-Fix-crash-by-zero-initializing-data.patch[1]

All patches automatically rebased

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.83&id=246bcd05ba6cc43b34ac0bb4bac3ea94a4efa07c

Build system: x86_64
Build-tested: bcm2711/RPi4B
Run-tested: bcm2711/RPi4B

Signed-off-by: John Audia <therealgraysky@proton.me>
2022-12-14 23:34:50 +01:00

58 lines
1.7 KiB
Diff

From 6e08e0fa4ba16546fdbb2cdcc4ee6483bd0a6956 Mon Sep 17 00:00:00 2001
From: Maxime Ripard <maxime@cerno.tech>
Date: Mon, 17 Jan 2022 16:43:52 +0100
Subject: [PATCH] clk: Add clk_drop_range
In order to reset the range on a clock, we need to call
clk_set_rate_range with a minimum of 0 and a maximum of ULONG_MAX. Since
it's fairly inconvenient, let's introduce a clk_drop_range() function
that will do just this.
Suggested-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
drivers/clk/clk_test.c | 4 ++--
include/linux/clk.h | 11 +++++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
--- a/drivers/clk/clk_test.c
+++ b/drivers/clk/clk_test.c
@@ -645,7 +645,7 @@ static void clk_range_test_multiple_set_
KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1);
KUNIT_ASSERT_EQ(test,
- clk_set_rate_range(user2, 0, ULONG_MAX),
+ clk_drop_range(user2),
0);
rate = clk_get_rate(clk);
@@ -762,7 +762,7 @@ static void clk_range_test_multiple_set_
KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_2);
KUNIT_ASSERT_EQ(test,
- clk_set_rate_range(user2, 0, ULONG_MAX),
+ clk_drop_range(user2),
0);
rate = clk_get_rate(clk);
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -1096,6 +1096,17 @@ static inline void clk_bulk_disable_unpr
}
/**
+ * clk_drop_range - Reset any range set on that clock
+ * @clk: clock source
+ *
+ * Returns success (0) or negative errno.
+ */
+static inline int clk_drop_range(struct clk *clk)
+{
+ return clk_set_rate_range(clk, 0, ULONG_MAX);
+}
+
+/**
* clk_get_optional - lookup and obtain a reference to an optional clock
* producer.
* @dev: device for clock "consumer"