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

Note that the changes to the three header files were done by hand.

Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Signed-off-by: Brian Masney <bmasney@redhat.com>
drivers/clk/sifive/fu540-prci.h
drivers/clk/sifive/fu740-prci.h
drivers/clk/sifive/sifive-prci.c
drivers/clk/sifive/sifive-prci.h

index e0173324f3c52adf128b65c02afcd94069af8ccb..d45193c210b4be658ee8c1fb81b3be612d19772f 100644 (file)
@@ -49,7 +49,7 @@ static struct __prci_wrpll_data sifive_fu540_prci_gemgxlpll_data = {
 
 static const struct clk_ops sifive_fu540_prci_wrpll_clk_ops = {
        .set_rate = sifive_prci_wrpll_set_rate,
-       .round_rate = sifive_prci_wrpll_round_rate,
+       .determine_rate = sifive_prci_wrpll_determine_rate,
        .recalc_rate = sifive_prci_wrpll_recalc_rate,
        .enable = sifive_prci_clock_enable,
        .disable = sifive_prci_clock_disable,
index f31cd30fc3951e0c8a9f9c01c7abc7b7ad39c057..c605a899d97de76a03c58b7c1209292e7acebbb0 100644 (file)
@@ -55,7 +55,7 @@ static struct __prci_wrpll_data sifive_fu740_prci_cltxpll_data = {
 
 static const struct clk_ops sifive_fu740_prci_wrpll_clk_ops = {
        .set_rate = sifive_prci_wrpll_set_rate,
-       .round_rate = sifive_prci_wrpll_round_rate,
+       .determine_rate = sifive_prci_wrpll_determine_rate,
        .recalc_rate = sifive_prci_wrpll_recalc_rate,
        .enable = sifive_prci_clock_enable,
        .disable = sifive_prci_clock_disable,
index caba0400f8a2cf97446a7722c28f6b2eb627dcf5..4d1cc7adb2b32d99a2187ca80dbdef7f90124309 100644 (file)
@@ -183,9 +183,8 @@ unsigned long sifive_prci_wrpll_recalc_rate(struct clk_hw *hw,
        return wrpll_calc_output_rate(&pwd->c, parent_rate);
 }
 
-long sifive_prci_wrpll_round_rate(struct clk_hw *hw,
-                                 unsigned long rate,
-                                 unsigned long *parent_rate)
+int sifive_prci_wrpll_determine_rate(struct clk_hw *hw,
+                                    struct clk_rate_request *req)
 {
        struct __prci_clock *pc = clk_hw_to_prci_clock(hw);
        struct __prci_wrpll_data *pwd = pc->pwd;
@@ -193,9 +192,11 @@ long sifive_prci_wrpll_round_rate(struct clk_hw *hw,
 
        memcpy(&c, &pwd->c, sizeof(c));
 
-       wrpll_configure_for_rate(&c, rate, *parent_rate);
+       wrpll_configure_for_rate(&c, req->rate, req->best_parent_rate);
 
-       return wrpll_calc_output_rate(&c, *parent_rate);
+       req->rate = wrpll_calc_output_rate(&c, req->best_parent_rate);
+
+       return 0;
 }
 
 int sifive_prci_wrpll_set_rate(struct clk_hw *hw,
index 91658a88af4ef6157563846399e4857ba83c8645..d74b2bddd08a0753409e0040b493bba1497593eb 100644 (file)
@@ -291,8 +291,8 @@ void sifive_prci_hfpclkpllsel_use_hfclk(struct __prci_data *pd);
 void sifive_prci_hfpclkpllsel_use_hfpclkpll(struct __prci_data *pd);
 
 /* Linux clock framework integration */
-long sifive_prci_wrpll_round_rate(struct clk_hw *hw, unsigned long rate,
-                                 unsigned long *parent_rate);
+int sifive_prci_wrpll_determine_rate(struct clk_hw *hw,
+                                    struct clk_rate_request *req);
 int sifive_prci_wrpll_set_rate(struct clk_hw *hw, unsigned long rate,
                               unsigned long parent_rate);
 int sifive_clk_is_enabled(struct clk_hw *hw);