]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
clk: qcom: spmi-pmic-div: convert from round_rate() to determine_rate()
authorBrian Masney <bmasney@redhat.com>
Thu, 3 Jul 2025 23:22:30 +0000 (19:22 -0400)
committerBjorn Andersson <andersson@kernel.org>
Thu, 17 Jul 2025 04:12:57 +0000 (23:12 -0500)
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: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250703-clk-cocci-drop-round-rate-v1-6-3a8da898367e@redhat.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/clk/qcom/clk-spmi-pmic-div.c

index 41a0a4f3b4fb316827365a522079dcd99630c49f..3e2ac6745325a1e0a30a4587d27f14d93011a225 100644 (file)
@@ -112,16 +112,18 @@ static void clk_spmi_pmic_div_disable(struct clk_hw *hw)
        spin_unlock_irqrestore(&clkdiv->lock, flags);
 }
 
-static long clk_spmi_pmic_div_round_rate(struct clk_hw *hw, unsigned long rate,
-                                        unsigned long *parent_rate)
+static int clk_spmi_pmic_div_determine_rate(struct clk_hw *hw,
+                                           struct clk_rate_request *req)
 {
        unsigned int div, div_factor;
 
-       div = DIV_ROUND_UP(*parent_rate, rate);
+       div = DIV_ROUND_UP(req->best_parent_rate, req->rate);
        div_factor = div_to_div_factor(div);
        div = div_factor_to_div(div_factor);
 
-       return *parent_rate / div;
+       req->rate = req->best_parent_rate / div;
+
+       return 0;
 }
 
 static unsigned long
@@ -169,7 +171,7 @@ static const struct clk_ops clk_spmi_pmic_div_ops = {
        .disable = clk_spmi_pmic_div_disable,
        .set_rate = clk_spmi_pmic_div_set_rate,
        .recalc_rate = clk_spmi_pmic_div_recalc_rate,
-       .round_rate = clk_spmi_pmic_div_round_rate,
+       .determine_rate = clk_spmi_pmic_div_determine_rate,
 };
 
 struct spmi_pmic_div_clk_cc {