]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
clk: baikal-t1: ccu-div: convert from round_rate() to determine_rate()
authorBrian Masney <bmasney@redhat.com>
Mon, 11 Aug 2025 15:18:02 +0000 (11:18 -0400)
committerBrian Masney <bmasney@redhat.com>
Mon, 8 Sep 2025 13:41:26 +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/baikal-t1/ccu-div.c

index 8d5fc7158f33f9c5f8a04241cb62f1ec6ced6e5d..849d1f55765f503c23954754b994d1c28fe3f525 100644 (file)
@@ -228,15 +228,18 @@ static inline unsigned long ccu_div_var_calc_divider(unsigned long rate,
                       CCU_DIV_CLKDIV_MAX(mask));
 }
 
-static long ccu_div_var_round_rate(struct clk_hw *hw, unsigned long rate,
-                                  unsigned long *parent_rate)
+static int ccu_div_var_determine_rate(struct clk_hw *hw,
+                                     struct clk_rate_request *req)
 {
        struct ccu_div *div = to_ccu_div(hw);
        unsigned long divider;
 
-       divider = ccu_div_var_calc_divider(rate, *parent_rate, div->mask);
+       divider = ccu_div_var_calc_divider(req->rate, req->best_parent_rate,
+                                          div->mask);
 
-       return ccu_div_calc_freq(*parent_rate, divider);
+       req->rate = ccu_div_calc_freq(req->best_parent_rate, divider);
+
+       return 0;
 }
 
 /*
@@ -308,12 +311,14 @@ static unsigned long ccu_div_fixed_recalc_rate(struct clk_hw *hw,
        return ccu_div_calc_freq(parent_rate, div->divider);
 }
 
-static long ccu_div_fixed_round_rate(struct clk_hw *hw, unsigned long rate,
-                                    unsigned long *parent_rate)
+static int ccu_div_fixed_determine_rate(struct clk_hw *hw,
+                                       struct clk_rate_request *req)
 {
        struct ccu_div *div = to_ccu_div(hw);
 
-       return ccu_div_calc_freq(*parent_rate, div->divider);
+       req->rate = ccu_div_calc_freq(req->best_parent_rate, div->divider);
+
+       return 0;
 }
 
 static int ccu_div_fixed_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -534,14 +539,14 @@ static const struct clk_ops ccu_div_var_gate_to_set_ops = {
        .disable = ccu_div_gate_disable,
        .is_enabled = ccu_div_gate_is_enabled,
        .recalc_rate = ccu_div_var_recalc_rate,
-       .round_rate = ccu_div_var_round_rate,
+       .determine_rate = ccu_div_var_determine_rate,
        .set_rate = ccu_div_var_set_rate_fast,
        .debug_init = ccu_div_var_debug_init
 };
 
 static const struct clk_ops ccu_div_var_nogate_ops = {
        .recalc_rate = ccu_div_var_recalc_rate,
-       .round_rate = ccu_div_var_round_rate,
+       .determine_rate = ccu_div_var_determine_rate,
        .set_rate = ccu_div_var_set_rate_slow,
        .debug_init = ccu_div_var_debug_init
 };
@@ -551,7 +556,7 @@ static const struct clk_ops ccu_div_gate_ops = {
        .disable = ccu_div_gate_disable,
        .is_enabled = ccu_div_gate_is_enabled,
        .recalc_rate = ccu_div_fixed_recalc_rate,
-       .round_rate = ccu_div_fixed_round_rate,
+       .determine_rate = ccu_div_fixed_determine_rate,
        .set_rate = ccu_div_fixed_set_rate,
        .debug_init = ccu_div_gate_debug_init
 };
@@ -565,7 +570,7 @@ static const struct clk_ops ccu_div_buf_ops = {
 
 static const struct clk_ops ccu_div_fixed_ops = {
        .recalc_rate = ccu_div_fixed_recalc_rate,
-       .round_rate = ccu_div_fixed_round_rate,
+       .determine_rate = ccu_div_fixed_determine_rate,
        .set_rate = ccu_div_fixed_set_rate,
        .debug_init = ccu_div_fixed_debug_init
 };