]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: spacemit: ccu_ddn: convert from round_rate() to determine_rate()
authorBrian Masney <bmasney@redhat.com>
Mon, 11 Aug 2025 15:18:41 +0000 (11:18 -0400)
committerYixun Lan <dlan@gentoo.org>
Mon, 25 Aug 2025 22:07:38 +0000 (06:07 +0800)
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>
Reviewed-by: Haylen Chu <heylenay@4d2.org>
Reviewed-by: Yixun Lan <dlan@kernel.org>
Link: https://lore.kernel.org/r/20250811-clk-for-stephen-round-rate-v1-49-b3bf97b038dc@redhat.com
Signed-off-by: Yixun Lan <dlan@gentoo.org>
drivers/clk/spacemit/ccu_ddn.c

index be311b045698e95a688a35858a8ac1bcfbffd2c7..02b68ea84db9bd3ecdde41f8013c48263edbd917 100644 (file)
@@ -39,13 +39,16 @@ static unsigned long ccu_ddn_calc_best_rate(struct ccu_ddn *ddn,
        return ccu_ddn_calc_rate(prate, *num, *den);
 }
 
-static long ccu_ddn_round_rate(struct clk_hw *hw, unsigned long rate,
-                              unsigned long *prate)
+static int ccu_ddn_determine_rate(struct clk_hw *hw,
+                                 struct clk_rate_request *req)
 {
        struct ccu_ddn *ddn = hw_to_ccu_ddn(hw);
        unsigned long num, den;
 
-       return ccu_ddn_calc_best_rate(ddn, rate, *prate, &num, &den);
+       req->rate = ccu_ddn_calc_best_rate(ddn, req->rate,
+                                          req->best_parent_rate, &num, &den);
+
+       return 0;
 }
 
 static unsigned long ccu_ddn_recalc_rate(struct clk_hw *hw, unsigned long prate)
@@ -78,6 +81,6 @@ static int ccu_ddn_set_rate(struct clk_hw *hw, unsigned long rate,
 
 const struct clk_ops spacemit_ccu_ddn_ops = {
        .recalc_rate    = ccu_ddn_recalc_rate,
-       .round_rate     = ccu_ddn_round_rate,
+       .determine_rate = ccu_ddn_determine_rate,
        .set_rate       = ccu_ddn_set_rate,
 };