Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/nvidia Protect tegra124_cpu_init_cpufreq agains...



details:   https://anonhg.NetBSD.org/src/rev/2eefe0bc8dbb
branches:  trunk
changeset: 937740:2eefe0bc8dbb
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Aug 25 13:33:43 2020 +0000

description:
Protect tegra124_cpu_init_cpufreq against being run more than once.

config_finalize will call all config_finalize_register functions until
all registered functions return 0.  rf_autoconfig currently returns 1
which means tegra124_cpu_init_cpufreq would get called multiple times.

diffstat:

 sys/arch/arm/nvidia/tegra124_cpu.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r 48c10136e372 -r 2eefe0bc8dbb sys/arch/arm/nvidia/tegra124_cpu.c
--- a/sys/arch/arm/nvidia/tegra124_cpu.c        Tue Aug 25 01:37:38 2020 +0000
+++ b/sys/arch/arm/nvidia/tegra124_cpu.c        Tue Aug 25 13:33:43 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra124_cpu.c,v 1.4 2017/06/02 00:09:56 jmcneill Exp $ */
+/* $NetBSD: tegra124_cpu.c,v 1.5 2020/08/25 13:33:43 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra124_cpu.c,v 1.4 2017/06/02 00:09:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra124_cpu.c,v 1.5 2020/08/25 13:33:43 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -140,9 +140,14 @@
        config_finalize_register(self, tegra124_cpu_init_cpufreq);
 }
 
+static bool tegra124_cpu_init_done = false;
+
 static int
 tegra124_cpu_init_cpufreq(device_t dev)
 {
+       if (tegra124_cpu_init_done)
+               return 0;
+
        tegra124_speedo_init();
 
        int cpu_node = OF_finddevice("/cpus/cpu@0");
@@ -162,6 +167,8 @@
 
        tegra_cpufreq_register(&tegra124_cpufreq_func);
 
+       tegra124_cpu_init_done = true;
+
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index