-/* $OpenBSD: acpi.c,v 1.407 2022/02/01 18:09:00 deraadt Exp $ */
+/* $OpenBSD: acpi.c,v 1.408 2022/02/02 04:05:16 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
#include <sys/buf.h>
#include <sys/device.h>
#include <sys/malloc.h>
+#include <sys/pool.h>
#include <sys/fcntl.h>
#include <sys/ioccom.h>
#include <sys/event.h>
int acpi_hasprocfvs;
int acpi_haspci;
+struct pool acpiwqpool;
+
#define ACPIEN_RETRIES 15
struct aml_node *acpi_pci_match(struct device *, struct pci_attach_args *);
}
rsdp = (struct acpi_rsdp *)handle.va;
+ pool_init(&acpiwqpool, sizeof(struct acpi_taskq), 0, IPL_BIO, 0,
+ "acpiwqpl", NULL);
+ pool_setlowat(&acpiwqpool, 16);
+
SIMPLEQ_INIT(&sc->sc_tables);
SIMPLEQ_INIT(&sc->sc_wakedevs);
#if NACPIPWRRES > 0
struct acpi_taskq *wq;
int s;
- wq = malloc(sizeof(*wq), M_DEVBUF, M_ZERO | M_NOWAIT);
- if (wq == NULL)
+ wq = pool_get(&acpiwqpool, PR_ZERO | PR_NOWAIT);
+ if (wq == NULL) {
+ printf("unable to create task");
return;
+ }
wq->handler = handler;
wq->arg0 = arg0;
wq->arg1 = arg1;
wq->handler(wq->arg0, wq->arg1);
- free(wq, M_DEVBUF, sizeof(*wq));
+ pool_put(&acpiwqpool, wq);
/* We did something */
return (1);