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

index 483285b30c13d90117850458998b8fd6136574b8..adcc603e32593121f7e760e62e77a06a976672e7 100644 (file)
@@ -900,17 +900,18 @@ static unsigned long vc7_fod_recalc_rate(struct clk_hw *hw, unsigned long parent
        return fod_rate;
 }
 
-static long vc7_fod_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *parent_rate)
+static int vc7_fod_determine_rate(struct clk_hw *hw,
+                                 struct clk_rate_request *req)
 {
        struct vc7_fod_data *fod = container_of(hw, struct vc7_fod_data, hw);
        unsigned long fod_rate;
 
        pr_debug("%s - %s: requested rate: %lu, parent_rate: %lu\n",
-                __func__, clk_hw_get_name(hw), rate, *parent_rate);
+                __func__, clk_hw_get_name(hw), req->rate, req->best_parent_rate);
 
-       vc7_calc_fod_divider(rate, *parent_rate,
+       vc7_calc_fod_divider(req->rate, req->best_parent_rate,
                             &fod->fod_1st_int, &fod->fod_2nd_int, &fod->fod_frac);
-       fod_rate = vc7_calc_fod_2nd_stage_rate(*parent_rate, fod->fod_1st_int,
+       fod_rate = vc7_calc_fod_2nd_stage_rate(req->best_parent_rate, fod->fod_1st_int,
                                               fod->fod_2nd_int, fod->fod_frac);
 
        pr_debug("%s - %s: fod_1st_int: %u, fod_2nd_int: %u, fod_frac: %llu\n",
@@ -918,7 +919,9 @@ static long vc7_fod_round_rate(struct clk_hw *hw, unsigned long rate, unsigned l
                 fod->fod_1st_int, fod->fod_2nd_int, fod->fod_frac);
        pr_debug("%s - %s rate: %lu\n", __func__, clk_hw_get_name(hw), fod_rate);
 
-       return fod_rate;
+       req->rate = fod_rate;
+
+       return 0;
 }
 
 static int vc7_fod_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate)
@@ -952,7 +955,7 @@ static int vc7_fod_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long
 
 static const struct clk_ops vc7_fod_ops = {
        .recalc_rate = vc7_fod_recalc_rate,
-       .round_rate = vc7_fod_round_rate,
+       .determine_rate = vc7_fod_determine_rate,
        .set_rate = vc7_fod_set_rate,
 };
 
@@ -978,21 +981,24 @@ static unsigned long vc7_iod_recalc_rate(struct clk_hw *hw, unsigned long parent
        return iod_rate;
 }
 
-static long vc7_iod_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *parent_rate)
+static int vc7_iod_determine_rate(struct clk_hw *hw,
+                                 struct clk_rate_request *req)
 {
        struct vc7_iod_data *iod = container_of(hw, struct vc7_iod_data, hw);
        unsigned long iod_rate;
 
        pr_debug("%s - %s: requested rate: %lu, parent_rate: %lu\n",
-                __func__, clk_hw_get_name(hw), rate, *parent_rate);
+                __func__, clk_hw_get_name(hw), req->rate, req->best_parent_rate);
 
-       vc7_calc_iod_divider(rate, *parent_rate, &iod->iod_int);
-       iod_rate = div64_u64(*parent_rate, iod->iod_int);
+       vc7_calc_iod_divider(req->rate, req->best_parent_rate, &iod->iod_int);
+       iod_rate = div64_u64(req->best_parent_rate, iod->iod_int);
 
        pr_debug("%s - %s: iod_int: %u\n", __func__, clk_hw_get_name(hw), iod->iod_int);
        pr_debug("%s - %s rate: %ld\n", __func__, clk_hw_get_name(hw), iod_rate);
 
-       return iod_rate;
+       req->rate = iod_rate;
+
+       return 0;
 }
 
 static int vc7_iod_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate)
@@ -1023,7 +1029,7 @@ static int vc7_iod_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long
 
 static const struct clk_ops vc7_iod_ops = {
        .recalc_rate = vc7_iod_recalc_rate,
-       .round_rate = vc7_iod_round_rate,
+       .determine_rate = vc7_iod_determine_rate,
        .set_rate = vc7_iod_set_rate,
 };