]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
cpufreq: scmi: Fix build for !CONFIG_COMMON_CLK
authorSudeep Holla <sudeep.holla@arm.com>
Fri, 20 Nov 2020 10:12:52 +0000 (10:12 +0000)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 23 Nov 2020 04:45:56 +0000 (10:15 +0530)
Commit 8410e7f3b31e ("cpufreq: scmi: Fix OPP addition failure with a
dummy clock provider") registers a dummy clock provider using
devm_of_clk_add_hw_provider. These *_hw_provider functions are defined
only when CONFIG_COMMON_CLK=y. One possible fix is to add the Kconfig
dependency, but since we plan to move away from the clock dependency
for scmi cpufreq, it is preferrable to avoid that.

Let us just conditionally compile out the offending call to
devm_of_clk_add_hw_provider. It also uses the variable 'dev' outside
of the #ifdef block to avoid build warning.

Fixes: 8410e7f3b31e ("cpufreq: scmi: Fix OPP addition failure with a dummy clock provider")
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/scmi-cpufreq.c

index 78318508a6d6bc465e3c84b744c26e5fa84e07ef..8286205c7165dc61a490ecd52df0e9bed6b8ffd6 100644 (file)
@@ -236,13 +236,15 @@ static int scmi_cpufreq_probe(struct scmi_device *sdev)
        if (!handle || !handle->perf_ops)
                return -ENODEV;
 
+#ifdef CONFIG_COMMON_CLK
        /* dummy clock provider as needed by OPP if clocks property is used */
        if (of_find_property(dev->of_node, "#clock-cells", NULL))
                devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL);
+#endif
 
        ret = cpufreq_register_driver(&scmi_cpufreq_driver);
        if (ret) {
-               dev_err(&sdev->dev, "%s: registering cpufreq failed, err: %d\n",
+               dev_err(dev, "%s: registering cpufreq failed, err: %d\n",
                        __func__, ret);
        }