git: 15bd2f366d3e - main - acpi: Create cppc_notify sysctl before it is checked

From: Tom Jones <thj_at_FreeBSD.org>
Date: Sun, 23 Oct 2022 09:11:32 UTC
The branch main has been updated by thj:

URL: https://cgit.FreeBSD.org/src/commit/?id=15bd2f366d3e878f5a8bc1628368d59ef318af5f

commit 15bd2f366d3e878f5a8bc1628368d59ef318af5f
Author:     Tom Jones <thj@FreeBSD.org>
AuthorDate: 2022-10-23 09:09:28 +0000
Commit:     Tom Jones <thj@FreeBSD.org>
CommitDate: 2022-10-23 09:10:56 +0000

    acpi: Create cppc_notify sysctl before it is checked
    
    Reported by:    Henrix
    Reviewed by:    jhb
    Differential Revision:  https://reviews.freebsd.org/D37081
---
 sys/dev/acpica/acpi_cpu.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index ea99cfdeb90f..92809966bfba 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -381,6 +381,14 @@ acpi_cpu_attach(device_t dev)
 	cpu_sysctl_tree = SYSCTL_ADD_NODE(&cpu_sysctl_ctx,
 	    SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree), OID_AUTO, "cpu",
 	    CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "node for CPU children");
+
+#if defined(__i386__) || defined(__amd64__)
+	/* Add sysctl handler to control registering for CPPC notifications */
+	cppc_notify = 1;
+	SYSCTL_ADD_BOOL(&cpu_sysctl_ctx, SYSCTL_CHILDREN(cpu_sysctl_tree),
+	    OID_AUTO, "cppc_notify", CTLFLAG_RDTUN | CTLFLAG_MPSAFE,
+	    &cppc_notify, 0, "Register for CPPC Notifications");
+#endif
     }
 
     /*
@@ -987,14 +995,6 @@ acpi_cpu_startup(void *arg)
 	NULL, 0, acpi_cpu_global_cx_lowest_sysctl, "A",
 	"Global lowest Cx sleep state to use");
 
-#if defined(__i386__) || defined(__amd64__)
-    /* Add sysctl handler to control registering for CPPC notifications */
-    cppc_notify = 1;
-    SYSCTL_ADD_BOOL(&cpu_sysctl_ctx, SYSCTL_CHILDREN(cpu_sysctl_tree),
-	OID_AUTO, "cppc_notify", CTLFLAG_RDTUN | CTLFLAG_MPSAFE,
-	&cppc_notify, 0, "Register for CPPC Notifications");
-#endif
-
     /* Take over idling from cpu_idle_default(). */
     cpu_cx_lowest_lim = 0;
     CPU_FOREACH(i) {