summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2022-02-10 07:39:21 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2022-02-10 07:39:21 +0000
commit4bea054be298c41ba53b202d2c0e4058206e2b52 (patch)
treed7449bc9dbb31f3bd0d7c9590991ade2f1d16259 /sys/dev
parentb7314b7563b870a0a304a543d249b6c265f333ef (diff)
Embed klist head in acpi_softc to avoid explicit malloc.
OK kettenis@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpi.c18
-rw-r--r--sys/dev/acpi/acpivar.h6
2 files changed, 7 insertions, 17 deletions
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 <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -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 <tholo@sigmasoft.com>
*
@@ -23,6 +23,7 @@
#ifndef _ACPI_WAKECODE
+#include <sys/event.h>
#include <sys/timeout.h>
#include <sys/rwlock.h>
@@ -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;