diff mbox

[v1,07/11] cpufreq: tegra20: Check if this is Tegra20 machine

Message ID 20180517180056.13336-8-digetx@gmail.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Dmitry Osipenko May 17, 2018, 6 p.m. UTC
Don't even try to request the clocks during of module initialization on
non-Tegra20 machines (this is the case for a multi-platform kernel) for
consistency.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/cpufreq/tegra20-cpufreq.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Viresh Kumar May 18, 2018, 1:59 a.m. UTC | #1
On 17-05-18, 21:00, Dmitry Osipenko wrote:
> Don't even try to request the clocks during of module initialization on
> non-Tegra20 machines (this is the case for a multi-platform kernel) for
> consistency.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/cpufreq/tegra20-cpufreq.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/cpufreq/tegra20-cpufreq.c b/drivers/cpufreq/tegra20-cpufreq.c
> index 147ae3e14f18..797c61c74b65 100644
> --- a/drivers/cpufreq/tegra20-cpufreq.c
> +++ b/drivers/cpufreq/tegra20-cpufreq.c
> @@ -19,6 +19,7 @@
>  #include <linux/clk.h>
>  #include <linux/cpufreq.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
>  
>  static struct cpufreq_frequency_table freq_table[] = {
>  	{ .frequency = 216000 },
> @@ -155,6 +156,9 @@ static int __init tegra_cpufreq_init(void)
>  {
>  	int err;
>  
> +	if (!of_machine_is_compatible("nvidia,tegra20"))
> +		return -ENODEV;
> +
>  	cpu_clk = clk_get_sys(NULL, "cclk");
>  	if (IS_ERR(cpu_clk))
>  		return PTR_ERR(cpu_clk);

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Thierry Reding May 18, 2018, 8:58 a.m. UTC | #2
On Thu, May 17, 2018 at 09:00:52PM +0300, Dmitry Osipenko wrote:
> Don't even try to request the clocks during of module initialization on
> non-Tegra20 machines (this is the case for a multi-platform kernel) for
> consistency.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/cpufreq/tegra20-cpufreq.c | 4 ++++
>  1 file changed, 4 insertions(+)

Acked-by: Thierry Reding <treding@nvidia.com>
diff mbox

Patch

diff --git a/drivers/cpufreq/tegra20-cpufreq.c b/drivers/cpufreq/tegra20-cpufreq.c
index 147ae3e14f18..797c61c74b65 100644
--- a/drivers/cpufreq/tegra20-cpufreq.c
+++ b/drivers/cpufreq/tegra20-cpufreq.c
@@ -19,6 +19,7 @@ 
 #include <linux/clk.h>
 #include <linux/cpufreq.h>
 #include <linux/module.h>
+#include <linux/of.h>
 
 static struct cpufreq_frequency_table freq_table[] = {
 	{ .frequency = 216000 },
@@ -155,6 +156,9 @@  static int __init tegra_cpufreq_init(void)
 {
 	int err;
 
+	if (!of_machine_is_compatible("nvidia,tegra20"))
+		return -ENODEV;
+
 	cpu_clk = clk_get_sys(NULL, "cclk");
 	if (IS_ERR(cpu_clk))
 		return PTR_ERR(cpu_clk);