]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
clk: at91: sam9x60-pll: convert from round_rate() to determine_rate()
authorBrian Masney <bmasney@redhat.com>
Mon, 11 Aug 2025 15:18:00 +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/at91/clk-sam9x60-pll.c

index cefd9948e10393e4762f8a1f5f2ca0a7e1180a87..bc1498c5704ad9dadbef4e990156602f2dd0bfea 100644 (file)
@@ -230,12 +230,16 @@ static long sam9x60_frac_pll_compute_mul_frac(struct sam9x60_pll_core *core,
        return tmprate;
 }
 
-static long sam9x60_frac_pll_round_rate(struct clk_hw *hw, unsigned long rate,
-                                       unsigned long *parent_rate)
+static int sam9x60_frac_pll_determine_rate(struct clk_hw *hw,
+                                          struct clk_rate_request *req)
 {
        struct sam9x60_pll_core *core = to_sam9x60_pll_core(hw);
 
-       return sam9x60_frac_pll_compute_mul_frac(core, rate, *parent_rate, false);
+       req->rate = sam9x60_frac_pll_compute_mul_frac(core, req->rate,
+                                                     req->best_parent_rate,
+                                                     false);
+
+       return 0;
 }
 
 static int sam9x60_frac_pll_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -321,7 +325,7 @@ static const struct clk_ops sam9x60_frac_pll_ops = {
        .unprepare = sam9x60_frac_pll_unprepare,
        .is_prepared = sam9x60_frac_pll_is_prepared,
        .recalc_rate = sam9x60_frac_pll_recalc_rate,
-       .round_rate = sam9x60_frac_pll_round_rate,
+       .determine_rate = sam9x60_frac_pll_determine_rate,
        .set_rate = sam9x60_frac_pll_set_rate,
        .save_context = sam9x60_frac_pll_save_context,
        .restore_context = sam9x60_frac_pll_restore_context,
@@ -332,7 +336,7 @@ static const struct clk_ops sam9x60_frac_pll_ops_chg = {
        .unprepare = sam9x60_frac_pll_unprepare,
        .is_prepared = sam9x60_frac_pll_is_prepared,
        .recalc_rate = sam9x60_frac_pll_recalc_rate,
-       .round_rate = sam9x60_frac_pll_round_rate,
+       .determine_rate = sam9x60_frac_pll_determine_rate,
        .set_rate = sam9x60_frac_pll_set_rate_chg,
        .save_context = sam9x60_frac_pll_save_context,
        .restore_context = sam9x60_frac_pll_restore_context,
@@ -487,12 +491,15 @@ static long sam9x60_div_pll_compute_div(struct sam9x60_pll_core *core,
        return best_rate;
 }
 
-static long sam9x60_div_pll_round_rate(struct clk_hw *hw, unsigned long rate,
-                                      unsigned long *parent_rate)
+static int sam9x60_div_pll_determine_rate(struct clk_hw *hw,
+                                         struct clk_rate_request *req)
 {
        struct sam9x60_pll_core *core = to_sam9x60_pll_core(hw);
 
-       return sam9x60_div_pll_compute_div(core, parent_rate, rate);
+       req->rate = sam9x60_div_pll_compute_div(core, &req->best_parent_rate,
+                                               req->rate);
+
+       return 0;
 }
 
 static int sam9x60_div_pll_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -601,7 +608,7 @@ static const struct clk_ops sam9x60_div_pll_ops = {
        .unprepare = sam9x60_div_pll_unprepare,
        .is_prepared = sam9x60_div_pll_is_prepared,
        .recalc_rate = sam9x60_div_pll_recalc_rate,
-       .round_rate = sam9x60_div_pll_round_rate,
+       .determine_rate = sam9x60_div_pll_determine_rate,
        .set_rate = sam9x60_div_pll_set_rate,
        .save_context = sam9x60_div_pll_save_context,
        .restore_context = sam9x60_div_pll_restore_context,
@@ -612,7 +619,7 @@ static const struct clk_ops sam9x60_div_pll_ops_chg = {
        .unprepare = sam9x60_div_pll_unprepare,
        .is_prepared = sam9x60_div_pll_is_prepared,
        .recalc_rate = sam9x60_div_pll_recalc_rate,
-       .round_rate = sam9x60_div_pll_round_rate,
+       .determine_rate = sam9x60_div_pll_determine_rate,
        .set_rate = sam9x60_div_pll_set_rate_chg,
        .save_context = sam9x60_div_pll_save_context,
        .restore_context = sam9x60_div_pll_restore_context,
@@ -623,7 +630,7 @@ static const struct clk_ops sam9x60_fixed_div_pll_ops = {
        .unprepare = sam9x60_div_pll_unprepare,
        .is_prepared = sam9x60_div_pll_is_prepared,
        .recalc_rate = sam9x60_fixed_div_pll_recalc_rate,
-       .round_rate = sam9x60_div_pll_round_rate,
+       .determine_rate = sam9x60_div_pll_determine_rate,
        .save_context = sam9x60_div_pll_save_context,
        .restore_context = sam9x60_div_pll_restore_context,
 };