git: 2d3136984827 - stable/15 - acpi: Statically initialize acpi_ioctl_hooks
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 24 Apr 2026 15:29:02 UTC
The branch stable/15 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=2d313698482730bcabe60492e9a02e70e02eb53c
commit 2d313698482730bcabe60492e9a02e70e02eb53c
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-12-26 15:37:10 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-04-24 15:26:38 +0000
acpi: Statically initialize acpi_ioctl_hooks
Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D54313
(cherry picked from commit 11757b1487e3e8ca0479dff5da0815b42aea3fe0)
---
sys/dev/acpica/acpi.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index ce202bb60167..7db4c776b00b 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -4103,8 +4103,8 @@ struct acpi_ioctl_hook
void *arg;
};
-static TAILQ_HEAD(,acpi_ioctl_hook) acpi_ioctl_hooks;
-static int acpi_ioctl_hooks_initted;
+static TAILQ_HEAD(,acpi_ioctl_hook) acpi_ioctl_hooks =
+ TAILQ_HEAD_INITIALIZER(acpi_ioctl_hooks);
int
acpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg)
@@ -4117,10 +4117,6 @@ acpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg)
hp->arg = arg;
ACPI_LOCK(acpi);
- if (acpi_ioctl_hooks_initted == 0) {
- TAILQ_INIT(&acpi_ioctl_hooks);
- acpi_ioctl_hooks_initted = 1;
- }
TAILQ_FOREACH(thp, &acpi_ioctl_hooks, link) {
if (thp->cmd == cmd) {
ACPI_UNLOCK(acpi);
@@ -4179,11 +4175,10 @@ acpiioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *t
* Scan the list of registered ioctls, looking for handlers.
*/
ACPI_LOCK(acpi);
- if (acpi_ioctl_hooks_initted)
- TAILQ_FOREACH(hp, &acpi_ioctl_hooks, link) {
- if (hp->cmd == cmd)
- break;
- }
+ TAILQ_FOREACH(hp, &acpi_ioctl_hooks, link) {
+ if (hp->cmd == cmd)
+ break;
+ }
ACPI_UNLOCK(acpi);
if (hp)
return (hp->fn(cmd, addr, hp->arg));