bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0440-clk-Always-clamp-the-rounded-rate.patch
1 From 5efe54b26d470785883bec0264d8d5e145715038 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Wed, 5 May 2021 15:35:34 +0200
4 Subject: [PATCH] clk: Always clamp the rounded rate
5
6 The current core while setting the min and max rate properly in the
7 clk_request structure will not make sure that the requested rate is
8 within these boundaries, leaving it to each and every driver to make
9 sure it is.
10
11 Add a clamp call to make sure it's always done.
12
13 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
14 ---
15 drivers/clk/clk.c | 2 ++
16 1 file changed, 2 insertions(+)
17
18 --- a/drivers/clk/clk.c
19 +++ b/drivers/clk/clk.c
20 @@ -1347,6 +1347,8 @@ static int clk_core_determine_round_nolo
21 if (!core)
22 return 0;
23
24 + req->rate = clamp(req->rate, req->min_rate, req->max_rate);
25 +
26 /*
27 * At this point, core protection will be disabled
28 * - if the provider is not protected at all