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

index 88d798d510cdbe950a61a0bbb312dc546a6853fb..ed27fc796c941d8cf5b3297573db84a7830b7e4f 100644 (file)
@@ -164,23 +164,23 @@ static unsigned long audio_pll_recalc_rate(struct clk_hw *hw,
        return 0;
 }
 
-static long audio_pll_round_rate(struct clk_hw *hw, unsigned long rate,
-                                unsigned long *parent_rate)
+static int audio_pll_determine_rate(struct clk_hw *hw,
+                                   struct clk_rate_request *req)
 {
        unsigned int prediv;
        unsigned int postdiv;
        long rounded = 0;
 
        for (prediv = 0; prediv < ARRAY_SIZE(predivs); prediv++) {
-               if (predivs[prediv].parent_rate != *parent_rate)
+               if (predivs[prediv].parent_rate != req->best_parent_rate)
                        continue;
                for (postdiv = 0; postdiv < ARRAY_SIZE(postdivs); postdiv++) {
                        long freq = predivs[prediv].freq_vco;
 
                        freq /= postdivs[postdiv].divisor;
-                       if (freq == rate)
-                               return rate;
-                       if (freq < rate)
+                       if (freq == req->rate)
+                               return 0;
+                       if (freq < req->rate)
                                continue;
                        if (rounded && freq > rounded)
                                continue;
@@ -188,7 +188,9 @@ static long audio_pll_round_rate(struct clk_hw *hw, unsigned long rate,
                }
        }
 
-       return rounded;
+       req->rate = rounded;
+
+       return 0;
 }
 
 static int audio_pll_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -228,7 +230,7 @@ static int audio_pll_set_rate(struct clk_hw *hw, unsigned long rate,
 
 static const struct clk_ops audio_pll_ops = {
        .recalc_rate = audio_pll_recalc_rate,
-       .round_rate = audio_pll_round_rate,
+       .determine_rate = audio_pll_determine_rate,
        .set_rate = audio_pll_set_rate,
 };