From: visa Date: Thu, 10 Feb 2022 07:39:20 +0000 (+0000) Subject: Embed klist head in acpi_softc to avoid explicit malloc. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9890585b4f3fb1cb7bd5eb5baebb0e096189c6b8;p=openbsd Embed klist head in acpi_softc to avoid explicit malloc. OK kettenis@ --- diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 8cd83651f1c..308fe8611ca 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.411 2022/02/09 23:54:34 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.412 2022/02/10 07:39:20 visa Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -1016,16 +1016,6 @@ acpi_attach_common(struct acpi_softc *sc, paddr_t base) SIMPLEQ_INIT(&sc->sc_pwrresdevs); #endif /* NACPIPWRRES > 0 */ - -#ifndef SMALL_KERNEL - sc->sc_note = malloc(sizeof(struct klist), M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_note == NULL) { - printf(": can't allocate memory\n"); - acpi_unmap(&handle); - return; - } -#endif /* SMALL_KERNEL */ - if (acpi_loadtables(sc, rsdp)) { printf(": can't load tables\n"); acpi_unmap(&handle); @@ -3467,7 +3457,7 @@ acpi_record_event(struct acpi_softc *sc, u_int type) return (1); acpi_evindex++; - KNOTE(sc->sc_note, APM_EVENT_COMPOSE(type, acpi_evindex)); + KNOTE(&sc->sc_note, APM_EVENT_COMPOSE(type, acpi_evindex)); return (0); } @@ -3478,7 +3468,7 @@ acpi_filtdetach(struct knote *kn) int s; s = splbio(); - klist_remove_locked(sc->sc_note, kn); + klist_remove_locked(&sc->sc_note, kn); splx(s); } @@ -3512,7 +3502,7 @@ acpikqfilter(dev_t dev, struct knote *kn) kn->kn_hook = sc; s = splbio(); - klist_insert_locked(sc->sc_note, kn); + klist_insert_locked(&sc->sc_note, kn); splx(s); return (0); diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index 52b7526018c..53e84940fa1 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.118 2022/02/08 17:25:12 deraadt Exp $ */ +/* $OpenBSD: acpivar.h,v 1.119 2022/02/10 07:39:20 visa Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * @@ -23,6 +23,7 @@ #ifndef _ACPI_WAKECODE +#include #include #include @@ -45,7 +46,6 @@ extern int acpi_debug; extern int acpi_hasprocfvs; extern int acpi_haspci; -struct klist; struct acpiec_softc; struct acpipwrres_softc; @@ -239,7 +239,7 @@ struct acpi_softc { */ struct acpi_facs *sc_facs; /* Shared with firmware! */ - struct klist *sc_note; + struct klist sc_note; struct acpi_reg_map sc_pmregs[ACPIREG_MAXREG]; bus_space_handle_t sc_ioh_pm1a_evt;