]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
clk: mvebu: armada-37xx-periph: convert from round_rate() to determine_rate()
authorBrian Masney <bmasney@redhat.com>
Mon, 11 Aug 2025 15:19:18 +0000 (11:19 -0400)
committerBrian Masney <bmasney@redhat.com>
Mon, 8 Sep 2025 13:41:30 +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.

Signed-off-by: Brian Masney <bmasney@redhat.com>
drivers/clk/mvebu/armada-37xx-periph.c

index 13906e31bef8691c59631e7f1940e6cab82549a6..bd0bc8e7b1e7781c6ddeff2a00aab50e57ae30e2 100644 (file)
@@ -454,12 +454,12 @@ static unsigned long clk_pm_cpu_recalc_rate(struct clk_hw *hw,
        return DIV_ROUND_UP_ULL((u64)parent_rate, div);
 }
 
-static long clk_pm_cpu_round_rate(struct clk_hw *hw, unsigned long rate,
-                                 unsigned long *parent_rate)
+static int clk_pm_cpu_determine_rate(struct clk_hw *hw,
+                                    struct clk_rate_request *req)
 {
        struct clk_pm_cpu *pm_cpu = to_clk_pm_cpu(hw);
        struct regmap *base = pm_cpu->nb_pm_base;
-       unsigned int div = *parent_rate / rate;
+       unsigned int div = req->best_parent_rate / req->rate;
        unsigned int load_level;
        /* only available when DVFS is enabled */
        if (!armada_3700_pm_dvfs_is_enabled(base))
@@ -474,13 +474,16 @@ static long clk_pm_cpu_round_rate(struct clk_hw *hw, unsigned long rate,
 
                val >>= offset;
                val &= ARMADA_37XX_NB_TBG_DIV_MASK;
-               if (val == div)
+               if (val == div) {
                        /*
                         * We found a load level matching the target
                         * divider, switch to this load level and
                         * return.
                         */
-                       return *parent_rate / div;
+                       req->rate = req->best_parent_rate / div;
+
+                       return 0;
+               }
        }
 
        /* We didn't find any valid divider */
@@ -600,7 +603,7 @@ static int clk_pm_cpu_set_rate(struct clk_hw *hw, unsigned long rate,
 
 static const struct clk_ops clk_pm_cpu_ops = {
        .get_parent = clk_pm_cpu_get_parent,
-       .round_rate = clk_pm_cpu_round_rate,
+       .determine_rate = clk_pm_cpu_determine_rate,
        .set_rate = clk_pm_cpu_set_rate,
        .recalc_rate = clk_pm_cpu_recalc_rate,
 };