]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
clk: st: clkgen-pll: convert from round_rate() to determine_rate()
authorBrian Masney <bmasney@redhat.com>
Mon, 11 Aug 2025 15:18:48 +0000 (11:18 -0400)
committerBrian Masney <bmasney@redhat.com>
Mon, 8 Sep 2025 13:41:28 +0000 (09:41 -0400)
The round_rate() clk ops is deprecated, so migrate this driver from
round_rate() to determine_rate() using the Coccinelle semantic patch
on the cover letter of this series.

Note that prior to running the Coccinelle:

- round_rate_stm_pll4600c28() was renamed to stm_pll4600c28_round_rate()
- round_rate_stm_pll3200c32() was renamed to stm_pll3200c32_round_rate()

Signed-off-by: Brian Masney <bmasney@redhat.com>
drivers/clk/st/clkgen-pll.c

index b36e4d8036364a126fea3afdd8b936fb93de27f2..c258ff87a17127b872fb5591503e171571866a0e 100644 (file)
@@ -395,25 +395,28 @@ static unsigned long recalc_stm_pll3200c32(struct clk_hw *hw,
        return rate;
 }
 
-static long round_rate_stm_pll3200c32(struct clk_hw *hw, unsigned long rate,
-               unsigned long *prate)
+static int stm_pll3200c32_determine_rate(struct clk_hw *hw,
+                                        struct clk_rate_request *req)
 {
        struct stm_pll params;
 
-       if (!clk_pll3200c32_get_params(*prate, rate, &params))
-               clk_pll3200c32_get_rate(*prate, &params, &rate);
+       if (!clk_pll3200c32_get_params(req->best_parent_rate, req->rate, &params))
+               clk_pll3200c32_get_rate(req->best_parent_rate, &params,
+                                       &req->rate);
        else {
                pr_debug("%s: %s rate %ld Invalid\n", __func__,
-                        __clk_get_name(hw->clk), rate);
+                        __clk_get_name(hw->clk), req->rate);
+               req->rate = 0;
+
                return 0;
        }
 
        pr_debug("%s: %s new rate %ld [ndiv=%u] [idf=%u]\n",
                 __func__, __clk_get_name(hw->clk),
-                rate, (unsigned int)params.ndiv,
+                req->rate, (unsigned int)params.ndiv,
                 (unsigned int)params.idf);
 
-       return rate;
+       return 0;
 }
 
 static int set_rate_stm_pll3200c32(struct clk_hw *hw, unsigned long rate,
@@ -549,25 +552,28 @@ static unsigned long recalc_stm_pll4600c28(struct clk_hw *hw,
        return rate;
 }
 
-static long round_rate_stm_pll4600c28(struct clk_hw *hw, unsigned long rate,
-                                     unsigned long *prate)
+static int stm_pll4600c28_determine_rate(struct clk_hw *hw,
+                                        struct clk_rate_request *req)
 {
        struct stm_pll params;
 
-       if (!clk_pll4600c28_get_params(*prate, rate, &params)) {
-               clk_pll4600c28_get_rate(*prate, &params, &rate);
+       if (!clk_pll4600c28_get_params(req->best_parent_rate, req->rate, &params)) {
+               clk_pll4600c28_get_rate(req->best_parent_rate, &params,
+                                       &req->rate);
        } else {
                pr_debug("%s: %s rate %ld Invalid\n", __func__,
-                        __clk_get_name(hw->clk), rate);
+                        __clk_get_name(hw->clk), req->rate);
+               req->rate = 0;
+
                return 0;
        }
 
        pr_debug("%s: %s new rate %ld [ndiv=%u] [idf=%u]\n",
                 __func__, __clk_get_name(hw->clk),
-                rate, (unsigned int)params.ndiv,
+                req->rate, (unsigned int)params.ndiv,
                 (unsigned int)params.idf);
 
-       return rate;
+       return 0;
 }
 
 static int set_rate_stm_pll4600c28(struct clk_hw *hw, unsigned long rate,
@@ -628,7 +634,7 @@ static const struct clk_ops stm_pll3200c32_a9_ops = {
        .disable        = clkgen_pll_disable,
        .is_enabled     = clkgen_pll_is_enabled,
        .recalc_rate    = recalc_stm_pll3200c32,
-       .round_rate     = round_rate_stm_pll3200c32,
+       .determine_rate = stm_pll3200c32_determine_rate,
        .set_rate       = set_rate_stm_pll3200c32,
 };
 
@@ -637,7 +643,7 @@ static const struct clk_ops stm_pll4600c28_ops = {
        .disable        = clkgen_pll_disable,
        .is_enabled     = clkgen_pll_is_enabled,
        .recalc_rate    = recalc_stm_pll4600c28,
-       .round_rate     = round_rate_stm_pll4600c28,
+       .determine_rate = stm_pll4600c28_determine_rate,
        .set_rate       = set_rate_stm_pll4600c28,
 };