]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
clk: scmi: Use new simplified per-clock rate properties
authorCristian Marussi <cristian.marussi@arm.com>
Fri, 8 May 2026 15:32:50 +0000 (16:32 +0100)
committerSudeep Holla <sudeep.holla@kernel.org>
Tue, 12 May 2026 14:29:11 +0000 (15:29 +0100)
Use the new min_rate and max_rate unified properties that provide the
proper values without having to consider the clock type.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20260508153300.2224715-6-cristian.marussi@arm.com
Reviewed-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
drivers/clk/clk-scmi.c

index c223e4ef1dd17acef27e247bf8785250a1f16b5e..7c562559ad8bb47f2613d3740e609d37adbd30de 100644 (file)
@@ -202,7 +202,6 @@ static int scmi_clk_ops_init(struct device *dev, struct scmi_clk *sclk,
                             const struct clk_ops *scmi_ops)
 {
        int ret;
-       unsigned long min_rate, max_rate;
 
        struct clk_init_data init = {
                .flags = CLK_GET_RATE_NOCACHE,
@@ -217,20 +216,8 @@ static int scmi_clk_ops_init(struct device *dev, struct scmi_clk *sclk,
        if (ret)
                return ret;
 
-       if (sclk->info->rate_discrete) {
-               int num_rates = sclk->info->list.num_rates;
-
-               if (num_rates <= 0)
-                       return -EINVAL;
-
-               min_rate = sclk->info->list.rates[0];
-               max_rate = sclk->info->list.rates[num_rates - 1];
-       } else {
-               min_rate = sclk->info->range.min_rate;
-               max_rate = sclk->info->range.max_rate;
-       }
-
-       clk_hw_set_rate_range(&sclk->hw, min_rate, max_rate);
+       clk_hw_set_rate_range(&sclk->hw, sclk->info->min_rate,
+                             sclk->info->max_rate);
        return ret;
 }