]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/imx/ipuv3/imx-tve: convert from round_rate() to determine_rate()
authorBrian Masney <bmasney@redhat.com>
Mon, 11 Aug 2025 10:56:05 +0000 (06:56 -0400)
committerRaphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Mon, 15 Sep 2025 13:08:14 +0000 (15:08 +0200)
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: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250811-drm-clk-round-rate-v2-1-4a91ccf239cf@redhat.com
Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
drivers/gpu/drm/imx/ipuv3/imx-tve.c

index c5629e155d25aef5b43445bc18c6c90039c99974..63f23b821b0be66a8e8a379e1375ffd98552e72f 100644 (file)
@@ -368,17 +368,20 @@ static unsigned long clk_tve_di_recalc_rate(struct clk_hw *hw,
        return 0;
 }
 
-static long clk_tve_di_round_rate(struct clk_hw *hw, unsigned long rate,
-                                 unsigned long *prate)
+static int clk_tve_di_determine_rate(struct clk_hw *hw,
+                                    struct clk_rate_request *req)
 {
        unsigned long div;
 
-       div = *prate / rate;
+       div = req->best_parent_rate / req->rate;
        if (div >= 4)
-               return *prate / 4;
+               req->rate = req->best_parent_rate / 4;
        else if (div >= 2)
-               return *prate / 2;
-       return *prate;
+               req->rate = req->best_parent_rate / 2;
+       else
+               req->rate = req->best_parent_rate;
+
+       return 0;
 }
 
 static int clk_tve_di_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -409,7 +412,7 @@ static int clk_tve_di_set_rate(struct clk_hw *hw, unsigned long rate,
 }
 
 static const struct clk_ops clk_tve_di_ops = {
-       .round_rate = clk_tve_di_round_rate,
+       .determine_rate = clk_tve_di_determine_rate,
        .set_rate = clk_tve_di_set_rate,
        .recalc_rate = clk_tve_di_recalc_rate,
 };