aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2019-05-20 00:38:23 +0000
committerConrad Meyer <cem@FreeBSD.org>2019-05-20 00:38:23 +0000
commite2e050c8ef733138fc6a9e514e4b856fefbc3ff1 (patch)
treef2ba0e6ef3f572211c35dcb8f9aef4f132a08d96 /sys
parent2ad7ed6e4a84448234e9aaef3c9fa884848f7387 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/vmm/io/iommu.c4
-rw-r--r--sys/arm/allwinner/a10/a10_intc.c3
-rw-r--r--sys/arm/allwinner/a10_dmac.c2
-rw-r--r--sys/arm/allwinner/a31_dmac.c2
-rw-r--r--sys/arm/allwinner/aw_ccu.c2
-rw-r--r--sys/arm/allwinner/aw_reset.c2
-rw-r--r--sys/arm/allwinner/aw_rsb.c2
-rw-r--r--sys/arm/allwinner/aw_spi.c2
-rw-r--r--sys/arm/allwinner/aw_thermal.c1
-rw-r--r--sys/arm/allwinner/aw_wdog.c1
-rw-r--r--sys/arm/allwinner/clkng/aw_ccung.c2
-rw-r--r--sys/arm/arm/machdep.c1
-rw-r--r--sys/arm/arm/pl190.c2
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_rng.c1
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_wdog.c7
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2836.c2
-rw-r--r--sys/arm/freescale/imx/imx_wdog.c9
-rw-r--r--sys/arm/mv/armada/thermal.c3
-rw-r--r--sys/arm/mv/armada/wdt.c1
-rw-r--r--sys/arm/mv/mv_spi.c2
-rw-r--r--sys/arm/mv/timer.c1
-rw-r--r--sys/arm/nvidia/tegra124/tegra124_machdep.c5
-rw-r--r--sys/arm/nvidia/tegra124/tegra124_pmc.c6
-rw-r--r--sys/arm/nvidia/tegra_xhci.c10
-rw-r--r--sys/arm/ti/ti_pruss.c2
-rw-r--r--sys/arm/ti/ti_wdt.c1
-rw-r--r--sys/arm/versatile/versatile_pci.c4
-rw-r--r--sys/arm/versatile/versatile_sic.c2
-rw-r--r--sys/arm64/arm64/gicv3_its.c2
-rw-r--r--sys/arm64/arm64/machdep.c3
-rw-r--r--sys/arm64/coresight/coresight.c2
-rw-r--r--sys/arm64/rockchip/clk/rk_cru.c2
-rw-r--r--sys/cam/cam_periph.h2
-rw-r--r--sys/cam/ctl/ctl_ha.c14
-rw-r--r--sys/cddl/compat/opensolaris/kern/opensolaris.c2
-rw-r--r--sys/contrib/ipfilter/netinet/ip_fil_freebsd.c1
-rw-r--r--sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c4
-rw-r--r--sys/crypto/aesni/aesni.c9
-rw-r--r--sys/crypto/armv8/armv8_crypto.c2
-rw-r--r--sys/crypto/blake2/blake2_cryptodev.c3
-rw-r--r--sys/crypto/ccp/ccp.c2
-rw-r--r--sys/crypto/ccp/ccp_hardware.c2
-rw-r--r--sys/ddb/db_command.c1
-rw-r--r--sys/dev/acpi_support/acpi_panasonic.c3
-rw-r--r--sys/dev/acpica/acpi.c1
-rw-r--r--sys/dev/acpica/acpi_lid.c1
-rw-r--r--sys/dev/acpica/acpi_thermal.c1
-rw-r--r--sys/dev/acpica/acpi_video.c3
-rw-r--r--sys/dev/acpica/acpivar.h2
-rw-r--r--sys/dev/adb/adb_kbd.c2
-rw-r--r--sys/dev/adb/adb_mouse.c2
-rw-r--r--sys/dev/amdsbwd/amdsbwd.c1
-rw-r--r--sys/dev/atkbdc/psm.c1
-rw-r--r--sys/dev/cardbus/cardbus.c1
-rw-r--r--sys/dev/cmx/cmx.c2
-rw-r--r--sys/dev/coretemp/coretemp.c9
-rw-r--r--sys/dev/cxgbe/cxgbei/cxgbei.c1
-rw-r--r--sys/dev/cxgbe/cxgbei/icl_cxgbei.c1
-rw-r--r--sys/dev/cxgbe/tom/t4_tls.c1
-rw-r--r--sys/dev/dcons/dcons_crom.c1
-rw-r--r--sys/dev/dcons/dcons_os.c1
-rw-r--r--sys/dev/dcons/dcons_os.h2
-rw-r--r--sys/dev/evdev/evdev_private.h2
-rw-r--r--sys/dev/extres/syscon/syscon_generic.c1
-rw-r--r--sys/dev/firewire/firewire.c11
-rw-r--r--sys/dev/firewire/fwohci.c1
-rw-r--r--sys/dev/ichwd/ichwd.c1
-rw-r--r--sys/dev/ida/ida_disk.c2
-rw-r--r--sys/dev/ida/ida_pci.c2
-rw-r--r--sys/dev/iir/iir_ctrl.c12
-rw-r--r--sys/dev/ioat/ioat.c1
-rw-r--r--sys/dev/ipmi/ipmi.c3
-rw-r--r--sys/dev/ipmi/ipmi_opal.c3
-rw-r--r--sys/dev/ips/ips.c8
-rw-r--r--sys/dev/iscsi/icl_soft_proxy.c2
-rw-r--r--sys/dev/iscsi_initiator/iscsivar.h3
-rw-r--r--sys/dev/iwm/if_iwm_notif_wait.c3
-rw-r--r--sys/dev/led/led.c13
-rw-r--r--sys/dev/liquidio/lio_bsd.h1
-rw-r--r--sys/dev/mfi/mfi_disk.c16
-rw-r--r--sys/dev/mfi/mfi_pci.c13
-rw-r--r--sys/dev/mfi/mfi_syspd.c4
-rw-r--r--sys/dev/mlx/mlxvar.h3
-rw-r--r--sys/dev/mmc/host/dwmmc.c2
-rw-r--r--sys/dev/mpr/mprvar.h3
-rw-r--r--sys/dev/mps/mpsvar.h3
-rw-r--r--sys/dev/mrsas/mrsas.h1
-rw-r--r--sys/dev/nmdm/nmdm.c1
-rw-r--r--sys/dev/ntb/if_ntb/if_ntb.c1
-rw-r--r--sys/dev/ntb/ntb_hw/ntb_hw_intel.c1
-rw-r--r--sys/dev/ow/ow.c2
-rw-r--r--sys/dev/pccard/pccard.c7
-rw-r--r--sys/dev/pci/pci.c15
-rw-r--r--sys/dev/pci/pci_iov.c2
-rw-r--r--sys/dev/pci/pci_pci.c2
-rw-r--r--sys/dev/pci/pcivar.h2
-rw-r--r--sys/dev/scc/scc_core.c2
-rw-r--r--sys/dev/scc/scc_dev_quicc.c2
-rw-r--r--sys/dev/scc/scc_dev_sab82532.c2
-rw-r--r--sys/dev/scc/scc_dev_z8530.c2
-rw-r--r--sys/dev/smartpqi/smartpqi_includes.h3
-rw-r--r--sys/dev/sound/pcm/sound.h1
-rw-r--r--sys/dev/tws/tws.h15
-rw-r--r--sys/dev/usb/net/if_cdce.c4
-rw-r--r--sys/dev/usb/net/if_usie.c1
-rw-r--r--sys/dev/usb/net/uhso.c2
-rw-r--r--sys/dev/usb/serial/u3g.c4
-rw-r--r--sys/dev/usb/usb_device.c2
-rw-r--r--sys/dev/usb/usbdi.h2
-rw-r--r--sys/dev/usb/wlan/if_run.c1
-rw-r--r--sys/dev/viawd/viawd.c1
-rw-r--r--sys/dev/vkbd/vkbd.c1
-rw-r--r--sys/dev/vmware/vmci/vmci.c2
-rw-r--r--sys/dev/vt/vt_cpulogos.c2
-rw-r--r--sys/dev/vt/vt_sysmouse.c2
-rw-r--r--sys/dev/watchdog/watchdog.c11
-rw-r--r--sys/dev/xdma/xdma.c1
-rw-r--r--sys/dev/xdma/xdma_bank.c2
-rw-r--r--sys/dev/xdma/xdma_bio.c2
-rw-r--r--sys/dev/xdma/xdma_mbuf.c2
-rw-r--r--sys/dev/xdma/xdma_queue.c2
-rw-r--r--sys/dev/xdma/xdma_sg.c3
-rw-r--r--sys/dev/xen/console/xen_console.c1
-rw-r--r--sys/dev/xen/debug/debug.c2
-rw-r--r--sys/fs/devfs/devfs_vnops.c1
-rw-r--r--sys/i386/i386/elan-mmcr.c1
-rw-r--r--sys/i386/i386/geode.c1
-rw-r--r--sys/i386/i386/longrun.c1
-rw-r--r--sys/kern/bus_if.m2
-rw-r--r--sys/kern/init_main.c6
-rw-r--r--sys/kern/kern_clock.c1
-rw-r--r--sys/kern/kern_exec.c2
-rw-r--r--sys/kern/kern_exit.c2
-rw-r--r--sys/kern/kern_fork.c2
-rw-r--r--sys/kern/kern_proc.c3
-rw-r--r--sys/kern/subr_bus_dma.c1
-rw-r--r--sys/kern/subr_intr.c2
-rw-r--r--sys/kern/subr_power.c6
-rw-r--r--sys/kern/tty_tty.c1
-rw-r--r--sys/kern/vfs_mountroot.c1
-rw-r--r--sys/mips/atheros/ar71xx_machdep.c2
-rw-r--r--sys/mips/atheros/ar71xx_wdog.c1
-rw-r--r--sys/net/bpf.c8
-rw-r--r--sys/net/bpf.h3
-rw-r--r--sys/net/bpf_buffer.c2
-rw-r--r--sys/net/ethernet.h4
-rw-r--r--sys/net/if.c2
-rw-r--r--sys/net/if_clone.h4
-rw-r--r--sys/net/if_llatbl.c1
-rw-r--r--sys/net/if_llatbl.h2
-rw-r--r--sys/net/if_tuntap.c1
-rw-r--r--sys/net/if_var.h3
-rw-r--r--sys/net/if_vlan_var.h4
-rw-r--r--sys/netinet/if_ether.c1
-rw-r--r--sys/netinet/tcp_offload.c2
-rw-r--r--sys/netinet/toecore.c1
-rw-r--r--sys/netinet/toecore.h3
-rw-r--r--sys/netinet6/nd6.c1
-rw-r--r--sys/netinet6/nd6_nbr.c1
-rw-r--r--sys/powerpc/ofw/ofw_machdep.c1
-rw-r--r--sys/powerpc/powermac/cpcht.c2
-rw-r--r--sys/powerpc/powermac/cuda.c3
-rw-r--r--sys/powerpc/powermac/pmu.c3
-rw-r--r--sys/powerpc/powermac/smu.c3
-rw-r--r--sys/powerpc/powermac/vcoregpio.c1
-rw-r--r--sys/powerpc/powernv/opal.h2
-rw-r--r--sys/powerpc/powernv/opal_async.c2
-rw-r--r--sys/powerpc/powernv/opal_console.c11
-rw-r--r--sys/powerpc/powernv/opal_dev.c1
-rw-r--r--sys/powerpc/powernv/opal_flash.c1
-rw-r--r--sys/powerpc/powernv/opal_sensor.c5
-rw-r--r--sys/powerpc/powernv/xive.c2
-rw-r--r--sys/powerpc/powerpc/cpu.c2
-rw-r--r--sys/powerpc/powerpc/openpic.c1
-rw-r--r--sys/powerpc/ps3/ps3bus.c2
-rw-r--r--sys/powerpc/pseries/rtas_dev.c1
-rw-r--r--sys/powerpc/pseries/xics.c2
-rw-r--r--sys/riscv/riscv/intr_machdep.c1
-rw-r--r--sys/riscv/riscv/machdep.c1
-rw-r--r--sys/riscv/riscv/mp_machdep.c1
-rw-r--r--sys/security/audit/audit.c1
-rw-r--r--sys/security/audit/audit_trigger.c2
-rw-r--r--sys/sys/_eventhandler.h144
-rw-r--r--sys/sys/_lock.h34
-rw-r--r--sys/sys/bus.h4
-rw-r--r--sys/sys/conf.h2
-rw-r--r--sys/sys/cpu.h2
-rw-r--r--sys/sys/eventhandler.h25
-rw-r--r--sys/sys/interrupt.h3
-rw-r--r--sys/sys/lock.h32
-rw-r--r--sys/sys/param.h2
-rw-r--r--sys/sys/pcpu.h1
-rw-r--r--sys/sys/power.h2
-rw-r--r--sys/sys/proc.h15
-rw-r--r--sys/sys/watchdog.h2
-rw-r--r--sys/vm/swap_pager.c17
-rw-r--r--sys/x86/acpica/OsdEnvironment.c2
-rw-r--r--sys/x86/cpufreq/smist.c1
-rw-r--r--sys/x86/iommu/intel_drv.c1
-rw-r--r--sys/x86/iommu/intel_intrmap.c1
-rw-r--r--sys/x86/iommu/intel_quirks.c1
-rw-r--r--sys/x86/x86/tsc.c1
202 files changed, 588 insertions, 227 deletions
diff --git a/sys/amd64/vmm/io/iommu.c b/sys/amd64/vmm/io/iommu.c
index 09a67279b6da..4c42437b5595 100644
--- a/sys/amd64/vmm/io/iommu.c
+++ b/sys/amd64/vmm/io/iommu.c
@@ -32,10 +32,10 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/systm.h>
#include <sys/bus.h>
+#include <sys/eventhandler.h>
#include <sys/sysctl.h>
+#include <sys/systm.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
diff --git a/sys/arm/allwinner/a10/a10_intc.c b/sys/arm/allwinner/a10/a10_intc.c
index d865e4910707..f1319e91c025 100644
--- a/sys/arm/allwinner/a10/a10_intc.c
+++ b/sys/arm/allwinner/a10/a10_intc.c
@@ -30,11 +30,12 @@ __FBSDID("$FreeBSD$");
#include "opt_platform.h"
-#include <sys/types.h>
+#include <sys/param.h>
#include <sys/bus.h>
#include <sys/cpuset.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
+#include <sys/lock.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/param.h>
diff --git a/sys/arm/allwinner/a10_dmac.c b/sys/arm/allwinner/a10_dmac.c
index c670badf834b..28292ba7e5a4 100644
--- a/sys/arm/allwinner/a10_dmac.c
+++ b/sys/arm/allwinner/a10_dmac.c
@@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <sys/condvar.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
diff --git a/sys/arm/allwinner/a31_dmac.c b/sys/arm/allwinner/a31_dmac.c
index d6b3b78bd6de..8af9bca73f98 100644
--- a/sys/arm/allwinner/a31_dmac.c
+++ b/sys/arm/allwinner/a31_dmac.c
@@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <sys/condvar.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/endian.h>
#include <machine/bus.h>
diff --git a/sys/arm/allwinner/aw_ccu.c b/sys/arm/allwinner/aw_ccu.c
index 0503b3b2ca2c..efff2abc5433 100644
--- a/sys/arm/allwinner/aw_ccu.c
+++ b/sys/arm/allwinner/aw_ccu.c
@@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/rman.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
#include <dev/fdt/simplebus.h>
diff --git a/sys/arm/allwinner/aw_reset.c b/sys/arm/allwinner/aw_reset.c
index 3f56e9fdd167..c11e87aef0a7 100644
--- a/sys/arm/allwinner/aw_reset.c
+++ b/sys/arm/allwinner/aw_reset.c
@@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/rman.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
#include <dev/ofw/ofw_bus.h>
diff --git a/sys/arm/allwinner/aw_rsb.c b/sys/arm/allwinner/aw_rsb.c
index 44854bed8fb7..3fa871f418ed 100644
--- a/sys/arm/allwinner/aw_rsb.c
+++ b/sys/arm/allwinner/aw_rsb.c
@@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/rman.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
#include <dev/ofw/ofw_bus.h>
diff --git a/sys/arm/allwinner/aw_spi.c b/sys/arm/allwinner/aw_spi.c
index 37d0264d5a74..c85846f20732 100644
--- a/sys/arm/allwinner/aw_spi.c
+++ b/sys/arm/allwinner/aw_spi.c
@@ -32,7 +32,9 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/resource.h>
#include <machine/bus.h>
diff --git a/sys/arm/allwinner/aw_thermal.c b/sys/arm/allwinner/aw_thermal.c
index 9edfdb98569b..1c052ae29ee3 100644
--- a/sys/arm/allwinner/aw_thermal.c
+++ b/sys/arm/allwinner/aw_thermal.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/eventhandler.h>
#include <sys/bus.h>
#include <sys/rman.h>
#include <sys/kernel.h>
diff --git a/sys/arm/allwinner/aw_wdog.c b/sys/arm/allwinner/aw_wdog.c
index 2510076f03b2..5824fb96062f 100644
--- a/sys/arm/allwinner/aw_wdog.c
+++ b/sys/arm/allwinner/aw_wdog.c
@@ -28,6 +28,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/systm.h>
#include <sys/watchdog.h>
#include <sys/reboot.h>
diff --git a/sys/arm/allwinner/clkng/aw_ccung.c b/sys/arm/allwinner/clkng/aw_ccung.c
index 3d40e4be16b1..2e108cce707d 100644
--- a/sys/arm/allwinner/clkng/aw_ccung.c
+++ b/sys/arm/allwinner/clkng/aw_ccung.c
@@ -39,7 +39,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/rman.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
#include <dev/fdt/simplebus.h>
diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c
index 4755c1aa506a..dc0a84404f02 100644
--- a/sys/arm/arm/machdep.c
+++ b/sys/arm/arm/machdep.c
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
#include <sys/imgact.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/linker.h>
#include <sys/msgbuf.h>
#include <sys/reboot.h>
diff --git a/sys/arm/arm/pl190.c b/sys/arm/arm/pl190.c
index 3372338c98ed..a8ca18effb8c 100644
--- a/sys/arm/arm/pl190.c
+++ b/sys/arm/arm/pl190.c
@@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/rman.h>
#include <machine/bus.h>
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_rng.c b/sys/arm/broadcom/bcm2835/bcm2835_rng.c
index eb031e8c6ee8..88d26129feae 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_rng.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_rng.c
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_wdog.c b/sys/arm/broadcom/bcm2835/bcm2835_wdog.c
index d823adfd0700..1a6194534e02 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_wdog.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_wdog.c
@@ -29,12 +29,15 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/watchdog.h>
#include <sys/bus.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
+#include <sys/systm.h>
+#include <sys/watchdog.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
diff --git a/sys/arm/broadcom/bcm2835/bcm2836.c b/sys/arm/broadcom/bcm2835/bcm2836.c
index 09196476360b..6f690acfc2fb 100644
--- a/sys/arm/broadcom/bcm2835/bcm2836.c
+++ b/sys/arm/broadcom/bcm2835/bcm2836.c
@@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/cpuset.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/rman.h>
#ifdef SMP
diff --git a/sys/arm/freescale/imx/imx_wdog.c b/sys/arm/freescale/imx/imx_wdog.c
index 84c16e2ae003..df2ae510e5fb 100644
--- a/sys/arm/freescale/imx/imx_wdog.c
+++ b/sys/arm/freescale/imx/imx_wdog.c
@@ -33,13 +33,16 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
-#include <sys/time.h>
-#include <sys/bus.h>
+#include <sys/mutex.h>
#include <sys/resource.h>
#include <sys/rman.h>
+#include <sys/systm.h>
+#include <sys/time.h>
#include <sys/watchdog.h>
#include <machine/bus.h>
diff --git a/sys/arm/mv/armada/thermal.c b/sys/arm/mv/armada/thermal.c
index e27add408ad5..a2f6ed78c487 100644
--- a/sys/arm/mv/armada/thermal.c
+++ b/sys/arm/mv/armada/thermal.c
@@ -33,9 +33,10 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/rman.h>
-#include <sys/types.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/resource.h>
#include <machine/fdt.h>
diff --git a/sys/arm/mv/armada/wdt.c b/sys/arm/mv/armada/wdt.c
index 1f556d0e87d4..edc91e602211 100644
--- a/sys/arm/mv/armada/wdt.c
+++ b/sys/arm/mv/armada/wdt.c
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/malloc.h>
diff --git a/sys/arm/mv/mv_spi.c b/sys/arm/mv/mv_spi.c
index 8e02e4162541..1ad3b5749da5 100644
--- a/sys/arm/mv/mv_spi.c
+++ b/sys/arm/mv/mv_spi.c
@@ -32,7 +32,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <machine/bus.h>
diff --git a/sys/arm/mv/timer.c b/sys/arm/mv/timer.c
index b47e2e5348d3..4d8b17ff9aaa 100644
--- a/sys/arm/mv/timer.c
+++ b/sys/arm/mv/timer.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/malloc.h>
diff --git a/sys/arm/nvidia/tegra124/tegra124_machdep.c b/sys/arm/nvidia/tegra124/tegra124_machdep.c
index ee65805738e3..f96f1fd35d0e 100644
--- a/sys/arm/nvidia/tegra124/tegra124_machdep.c
+++ b/sys/arm/nvidia/tegra124/tegra124_machdep.c
@@ -30,10 +30,11 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/systm.h>
#include <sys/bus.h>
-#include <sys/reboot.h>
#include <sys/devmap.h>
+#include <sys/lock.h>
+#include <sys/reboot.h>
+#include <sys/systm.h>
#include <vm/vm.h>
diff --git a/sys/arm/nvidia/tegra124/tegra124_pmc.c b/sys/arm/nvidia/tegra124/tegra124_pmc.c
index cae31238037f..7f40d8219d97 100644
--- a/sys/arm/nvidia/tegra124/tegra124_pmc.c
+++ b/sys/arm/nvidia/tegra124/tegra124_pmc.c
@@ -27,12 +27,14 @@
*/
#include <sys/param.h>
-#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
-#include <sys/module.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
+#include <sys/systm.h>
#include <machine/bus.h>
diff --git a/sys/arm/nvidia/tegra_xhci.c b/sys/arm/nvidia/tegra_xhci.c
index 7615e8809e61..c37caaaf793c 100644
--- a/sys/arm/nvidia/tegra_xhci.c
+++ b/sys/arm/nvidia/tegra_xhci.c
@@ -34,15 +34,17 @@ __FBSDID("$FreeBSD$");
#include "opt_platform.h"
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/condvar.h>
#include <sys/firmware.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
+#include <sys/systm.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
diff --git a/sys/arm/ti/ti_pruss.c b/sys/arm/ti/ti_pruss.c
index f755f9be16b3..c79380ec5bbe 100644
--- a/sys/arm/ti/ti_pruss.c
+++ b/sys/arm/ti/ti_pruss.c
@@ -38,8 +38,10 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/types.h>
#include <sys/sysctl.h>
diff --git a/sys/arm/ti/ti_wdt.c b/sys/arm/ti/ti_wdt.c
index 179b783029db..539e4d93950f 100644
--- a/sys/arm/ti/ti_wdt.c
+++ b/sys/arm/ti/ti_wdt.c
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/malloc.h>
diff --git a/sys/arm/versatile/versatile_pci.c b/sys/arm/versatile/versatile_pci.c
index bad283e7d36d..73e047180063 100644
--- a/sys/arm/versatile/versatile_pci.c
+++ b/sys/arm/versatile/versatile_pci.c
@@ -33,8 +33,10 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
-#include <sys/module.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/watchdog.h>
diff --git a/sys/arm/versatile/versatile_sic.c b/sys/arm/versatile/versatile_sic.c
index 2451edfb136b..f3a35ce68a26 100644
--- a/sys/arm/versatile/versatile_sic.c
+++ b/sys/arm/versatile/versatile_sic.c
@@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/rman.h>
#include <machine/bus.h>
diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c
index a93ba5432177..5a9e858b1993 100644
--- a/sys/arm64/arm64/gicv3_its.c
+++ b/sys/arm64/arm64/gicv3_its.c
@@ -42,8 +42,10 @@ __FBSDID("$FreeBSD$");
#include <sys/cpuset.h>
#include <sys/endian.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/rman.h>
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index 4d6717e27541..b8ecfc08e676 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -42,8 +42,9 @@ __FBSDID("$FreeBSD$");
#include <sys/efi.h>
#include <sys/exec.h>
#include <sys/imgact.h>
-#include <sys/kdb.h>
+#include <sys/kdb.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/limits.h>
#include <sys/linker.h>
#include <sys/msgbuf.h>
diff --git a/sys/arm64/coresight/coresight.c b/sys/arm64/coresight/coresight.c
index 9a1f51701b87..16a456c576dd 100644
--- a/sys/arm64/coresight/coresight.c
+++ b/sys/arm64/coresight/coresight.c
@@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/rman.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
#include <dev/ofw/ofw_bus.h>
diff --git a/sys/arm64/rockchip/clk/rk_cru.c b/sys/arm64/rockchip/clk/rk_cru.c
index 14b401334c42..39544eae472f 100644
--- a/sys/arm64/rockchip/clk/rk_cru.c
+++ b/sys/arm64/rockchip/clk/rk_cru.c
@@ -40,7 +40,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/rman.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
#include <dev/fdt/simplebus.h>
diff --git a/sys/cam/cam_periph.h b/sys/cam/cam_periph.h
index b087b87296b9..8cd9f80003ca 100644
--- a/sys/cam/cam_periph.h
+++ b/sys/cam/cam_periph.h
@@ -37,6 +37,8 @@
#include <cam/cam_sim.h>
#ifdef _KERNEL
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
diff --git a/sys/cam/ctl/ctl_ha.c b/sys/cam/ctl/ctl_ha.c
index b158ab232283..952bafbcf0ef 100644
--- a/sys/cam/ctl/ctl_ha.c
+++ b/sys/cam/ctl/ctl_ha.c
@@ -30,23 +30,23 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/systm.h>
+#include <sys/condvar.h>
+#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
-#include <sys/types.h>
#include <sys/limits.h>
#include <sys/lock.h>
-#include <sys/module.h>
-#include <sys/mutex.h>
-#include <sys/condvar.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
-#include <sys/conf.h>
#include <sys/queue.h>
-#include <sys/sysctl.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
+#include <sys/sysctl.h>
+#include <sys/systm.h>
#include <sys/uio.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris.c b/sys/cddl/compat/opensolaris/kern/opensolaris.c
index 640b2f30b979..f804a1b561d1 100644
--- a/sys/cddl/compat/opensolaris/kern/opensolaris.c
+++ b/sys/cddl/compat/opensolaris/kern/opensolaris.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-#include <sys/types.h>
+#include <sys/param.h>
#include <sys/conf.h>
#include <sys/cpuvar.h>
#include <sys/errno.h>
diff --git a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
index fb85fd10c725..ad7d134c3c05 100644
--- a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
+++ b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
@@ -25,6 +25,7 @@ static const char rcsid[] = "@(#)$Id$";
# include "opt_random_ip_id.h"
#endif
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/conf.h>
#include <sys/errno.h>
#include <sys/types.h>
diff --git a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c
index 911face4f318..160dc23b8197 100644
--- a/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c
+++ b/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c
@@ -178,7 +178,6 @@ static const char *const ioctl_names[] = {
vchiq_static_assert((sizeof(ioctl_names)/sizeof(ioctl_names[0])) ==
(VCHIQ_IOC_MAX + 1));
-static eventhandler_tag vchiq_ehtag = NULL;
static d_open_t vchiq_open;
static d_close_t vchiq_close;
static d_ioctl_t vchiq_ioctl;
@@ -2918,9 +2917,6 @@ void vchiq_exit(void);
void
vchiq_exit(void)
{
- if (vchiq_ehtag == NULL)
- EVENTHANDLER_DEREGISTER(dev_clone, vchiq_ehtag);
- vchiq_ehtag = NULL;
vchiq_platform_exit(&g_state);
if (vchiq_cdev) {
diff --git a/sys/crypto/aesni/aesni.c b/sys/crypto/aesni/aesni.c
index f8fafcfb1a8f..b85d429f9e64 100644
--- a/sys/crypto/aesni/aesni.c
+++ b/sys/crypto/aesni/aesni.c
@@ -35,17 +35,18 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/kobj.h>
#include <sys/libkern.h>
#include <sys/lock.h>
-#include <sys/module.h>
#include <sys/malloc.h>
-#include <sys/bus.h>
-#include <sys/uio.h>
#include <sys/mbuf.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/smp.h>
+#include <sys/systm.h>
+#include <sys/uio.h>
#include <crypto/aesni/aesni.h>
#include <crypto/aesni/sha_sse.h>
diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c
index c11053cc8e17..172f7c9d3ba2 100644
--- a/sys/crypto/armv8/armv8_crypto.c
+++ b/sys/crypto/armv8/armv8_crypto.c
@@ -45,9 +45,11 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/endian.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/queue.h>
#include <sys/rwlock.h>
#include <sys/smp.h>
diff --git a/sys/crypto/blake2/blake2_cryptodev.c b/sys/crypto/blake2/blake2_cryptodev.c
index f6c0a5657629..d5150d04f76f 100644
--- a/sys/crypto/blake2/blake2_cryptodev.c
+++ b/sys/crypto/blake2/blake2_cryptodev.c
@@ -32,8 +32,9 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/kobj.h>
#include <sys/lock.h>
-#include <sys/module.h>
#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/rwlock.h>
#include <sys/smp.h>
diff --git a/sys/crypto/ccp/ccp.c b/sys/crypto/ccp/ccp.c
index 1983eac79444..27b623b0697c 100644
--- a/sys/crypto/ccp/ccp.c
+++ b/sys/crypto/ccp/ccp.c
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
#include "opt_ddb.h"
-#include <sys/types.h>
+#include <sys/param.h>
#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/kernel.h>
diff --git a/sys/crypto/ccp/ccp_hardware.c b/sys/crypto/ccp/ccp_hardware.c
index 3ed0724903e9..346b1e53f3f1 100644
--- a/sys/crypto/ccp/ccp_hardware.c
+++ b/sys/crypto/ccp/ccp_hardware.c
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
#include "opt_ddb.h"
-#include <sys/types.h>
+#include <sys/param.h>
#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/kernel.h>
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index 2fb0b9b4f33b..1a836be335bf 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -37,6 +37,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/linker_set.h>
#include <sys/lock.h>
#include <sys/kdb.h>
diff --git a/sys/dev/acpi_support/acpi_panasonic.c b/sys/dev/acpi_support/acpi_panasonic.c
index 87683aee7b47..b54b06cb61b4 100644
--- a/sys/dev/acpi_support/acpi_panasonic.c
+++ b/sys/dev/acpi_support/acpi_panasonic.c
@@ -31,10 +31,11 @@ __FBSDID("$FreeBSD$");
#include "opt_acpi.h"
#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
-#include <sys/bus.h>
#include <sys/power.h>
#include <contrib/dev/acpica/include/acpi.h>
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 7715f0f03b5d..c6b0796de478 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
#include "opt_acpi.h"
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/fcntl.h>
diff --git a/sys/dev/acpica/acpi_lid.c b/sys/dev/acpica/acpi_lid.c
index b7e6699214ad..80bc344d606d 100644
--- a/sys/dev/acpica/acpi_lid.c
+++ b/sys/dev/acpica/acpi_lid.c
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include "opt_acpi.h"
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/bus.h>
diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c
index f3ff8242591a..fa731deef42d 100644
--- a/sys/dev/acpica/acpi_thermal.c
+++ b/sys/dev/acpica/acpi_thermal.c
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
#include "opt_acpi.h"
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/cpu.h>
diff --git a/sys/dev/acpica/acpi_video.c b/sys/dev/acpica/acpi_video.c
index 6360071b50a7..ad3ac4eba751 100644
--- a/sys/dev/acpica/acpi_video.c
+++ b/sys/dev/acpica/acpi_video.c
@@ -30,10 +30,11 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
-#include <sys/bus.h>
#include <sys/power.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index a4e79fde9978..ec1cee6fb623 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -35,7 +35,7 @@
#include "acpi_if.h"
#include "bus_if.h"
-#include <sys/eventhandler.h>
+#include <sys/_eventhandler.h>
#ifdef INTRNG
#include <sys/intr.h>
#endif
diff --git a/sys/dev/adb/adb_kbd.c b/sys/dev/adb/adb_kbd.c
index 88399d54af7f..a45cb4963863 100644
--- a/sys/dev/adb/adb_kbd.c
+++ b/sys/dev/adb/adb_kbd.c
@@ -30,7 +30,9 @@
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/kbio.h>
diff --git a/sys/dev/adb/adb_mouse.c b/sys/dev/adb/adb_mouse.c
index 8b9e3fae7b63..8f0ccca3b3bd 100644
--- a/sys/dev/adb/adb_mouse.c
+++ b/sys/dev/adb/adb_mouse.c
@@ -30,7 +30,9 @@
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/mouse.h>
diff --git a/sys/dev/amdsbwd/amdsbwd.c b/sys/dev/amdsbwd/amdsbwd.c
index ca63a468cc5f..00acfac69a19 100644
--- a/sys/dev/amdsbwd/amdsbwd.c
+++ b/sys/dev/amdsbwd/amdsbwd.c
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include "opt_amdsbwd.h"
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/systm.h>
diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c
index aac497f7abbf..6c60ff5f7243 100644
--- a/sys/dev/atkbdc/psm.c
+++ b/sys/dev/atkbdc/psm.c
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/filio.h>
+#include <sys/mutex.h>
#include <sys/poll.h>
#include <sys/sigio.h>
#include <sys/signalvar.h>
diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c
index 21ff58c9262b..938e9b13459a 100644
--- a/sys/dev/cardbus/cardbus.c
+++ b/sys/dev/cardbus/cardbus.c
@@ -31,6 +31,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/module.h>
diff --git a/sys/dev/cmx/cmx.c b/sys/dev/cmx/cmx.c
index a7cd8ab22fbe..0621b4cc6cfe 100644
--- a/sys/dev/cmx/cmx.c
+++ b/sys/dev/cmx/cmx.c
@@ -41,7 +41,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/lock.h>
#include <sys/kernel.h>
+#include <sys/mutex.h>
#include <sys/sockio.h>
#include <sys/mbuf.h>
#include <sys/poll.h>
diff --git a/sys/dev/coretemp/coretemp.c b/sys/dev/coretemp/coretemp.c
index a68e3da9363b..e7063ff0aa77 100644
--- a/sys/dev/coretemp/coretemp.c
+++ b/sys/dev/coretemp/coretemp.c
@@ -36,14 +36,15 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/bus.h>
-#include <sys/systm.h>
-#include <sys/types.h>
-#include <sys/module.h>
#include <sys/conf.h>
#include <sys/kernel.h>
-#include <sys/sysctl.h>
+#include <sys/lock.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/proc.h> /* for curthread */
#include <sys/sched.h>
+#include <sys/sysctl.h>
+#include <sys/systm.h>
#include <machine/specialreg.h>
#include <machine/cpufunc.h>
diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c
index 17a16fb51993..b35154fef0b9 100644
--- a/sys/dev/cxgbe/cxgbei/cxgbei.c
+++ b/sys/dev/cxgbe/cxgbei/cxgbei.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/module.h>
#include <sys/systm.h>
diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
index c5e50135f7aa..a89c9b2a30eb 100644
--- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
+++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <sys/file.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
+#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/mbuf.h>
#include <sys/mutex.h>
diff --git a/sys/dev/cxgbe/tom/t4_tls.c b/sys/dev/cxgbe/tom/t4_tls.c
index 67518e42687e..5eca394aa880 100644
--- a/sys/dev/cxgbe/tom/t4_tls.c
+++ b/sys/dev/cxgbe/tom/t4_tls.c
@@ -33,6 +33,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/ktr.h>
#include <sys/sglist.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
diff --git a/sys/dev/dcons/dcons_crom.c b/sys/dev/dcons/dcons_crom.c
index 6bba3857d1b9..2a320ef65f3d 100644
--- a/sys/dev/dcons/dcons_crom.c
+++ b/sys/dev/dcons/dcons_crom.c
@@ -38,6 +38,7 @@
*/
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/systm.h>
diff --git a/sys/dev/dcons/dcons_os.c b/sys/dev/dcons/dcons_os.c
index 6853515c6820..97a00760d031 100644
--- a/sys/dev/dcons/dcons_os.c
+++ b/sys/dev/dcons/dcons_os.c
@@ -37,6 +37,7 @@
*/
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/kdb.h>
#include <gdb/gdb.h>
#include <sys/kernel.h>
diff --git a/sys/dev/dcons/dcons_os.h b/sys/dev/dcons/dcons_os.h
index 7421b4734d78..b8fc3afc39ef 100644
--- a/sys/dev/dcons/dcons_os.h
+++ b/sys/dev/dcons/dcons_os.h
@@ -36,6 +36,8 @@
* $FreeBSD$
*/
+#include <sys/_eventhandler.h>
+
typedef void (*dcons_poll_fn)(void *, int);
EVENTHANDLER_DECLARE(dcons_poll, dcons_poll_fn);
diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h
index 7e74bb35fe0a..d7f0b4eab62f 100644
--- a/sys/dev/evdev/evdev_private.h
+++ b/sys/dev/evdev/evdev_private.h
@@ -32,7 +32,9 @@
#include <sys/bitstring.h>
#include <sys/kbio.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/queue.h>
#include <sys/selinfo.h>
#include <sys/sysctl.h>
diff --git a/sys/dev/extres/syscon/syscon_generic.c b/sys/dev/extres/syscon/syscon_generic.c
index 8b18bd197097..776d877aab74 100644
--- a/sys/dev/extres/syscon/syscon_generic.c
+++ b/sys/dev/extres/syscon/syscon_generic.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <machine/bus.h>
diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c
index 3798188fdcb1..5e8cb3b83273 100644
--- a/sys/dev/firewire/firewire.c
+++ b/sys/dev/firewire/firewire.c
@@ -38,16 +38,15 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/types.h>
-
+#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/jail.h>
#include <sys/kernel.h>
-#include <sys/module.h>
+#include <sys/kthread.h>
#include <sys/malloc.h>
-#include <sys/conf.h>
+#include <sys/module.h>
#include <sys/sysctl.h>
-#include <sys/kthread.h>
+#include <sys/systm.h>
#include <sys/kdb.h>
#include <sys/bus.h> /* used by smbus and newbus */
diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c
index 03df023b7531..30eca83900e7 100644
--- a/sys/dev/firewire/fwohci.c
+++ b/sys/dev/firewire/fwohci.c
@@ -39,6 +39,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/lock.h>
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/sockio.h>
diff --git a/sys/dev/ichwd/ichwd.c b/sys/dev/ichwd/ichwd.c
index 12cf5ec592fd..6a73a3cd52c6 100644
--- a/sys/dev/ichwd/ichwd.c
+++ b/sys/dev/ichwd/ichwd.c
@@ -62,6 +62,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/systm.h>
diff --git a/sys/dev/ida/ida_disk.c b/sys/dev/ida/ida_disk.c
index 3d70a5e27fb2..c38b3795e219 100644
--- a/sys/dev/ida/ida_disk.c
+++ b/sys/dev/ida/ida_disk.c
@@ -41,6 +41,8 @@
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/cons.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
#include <sys/rman.h>
diff --git a/sys/dev/ida/ida_pci.c b/sys/dev/ida/ida_pci.c
index 3911a70c0b46..083d52ded3f1 100644
--- a/sys/dev/ida/ida_pci.c
+++ b/sys/dev/ida/ida_pci.c
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
#include <sys/bio.h>
#include <sys/bus.h>
#include <sys/conf.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
#include <machine/resource.h>
diff --git a/sys/dev/iir/iir_ctrl.c b/sys/dev/iir/iir_ctrl.c
index 0ec995a5b081..c4ed24ff50d9 100644
--- a/sys/dev/iir/iir_ctrl.c
+++ b/sys/dev/iir/iir_ctrl.c
@@ -46,16 +46,18 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
-#include <sys/endian.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/uio.h>
#include <sys/conf.h>
#include <sys/disk.h>
-#include <sys/stat.h>
#include <sys/disklabel.h>
+#include <sys/endian.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/mutex.h>
+#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
+#include <sys/uio.h>
#include <machine/bus.h>
#include <dev/iir/iir.h>
diff --git a/sys/dev/ioat/ioat.c b/sys/dev/ioat/ioat.c
index ca183490e8ae..b13d9da9be42 100644
--- a/sys/dev/ioat/ioat.c
+++ b/sys/dev/ioat/ioat.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/fail.h>
#include <sys/ioccom.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c
index a2c29098f021..612c58b54dbc 100644
--- a/sys/dev/ipmi/ipmi.c
+++ b/sys/dev/ipmi/ipmi.c
@@ -34,9 +34,12 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/condvar.h>
#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/poll.h>
#include <sys/reboot.h>
#include <sys/rman.h>
diff --git a/sys/dev/ipmi/ipmi_opal.c b/sys/dev/ipmi/ipmi_opal.c
index 5f3cdf393c20..432202eb653e 100644
--- a/sys/dev/ipmi/ipmi_opal.c
+++ b/sys/dev/ipmi/ipmi_opal.c
@@ -28,8 +28,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
+#include <sys/lock.h>
#include <sys/module.h>
-#include <sys/types.h>
+#include <sys/mutex.h>
#include <sys/bus.h>
#include <sys/kthread.h>
#include <sys/proc.h>
diff --git a/sys/dev/ips/ips.c b/sys/dev/ips/ips.c
index 20b93a0a4646..d1a93def519f 100644
--- a/sys/dev/ips/ips.c
+++ b/sys/dev/ips/ips.c
@@ -30,11 +30,15 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <dev/ips/ipsreg.h>
-#include <dev/ips/ips.h>
+#include <sys/types.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <dev/ips/ipsreg.h>
+#include <dev/ips/ips.h>
+
static d_open_t ips_open;
static d_close_t ips_close;
static d_ioctl_t ips_ioctl;
diff --git a/sys/dev/iscsi/icl_soft_proxy.c b/sys/dev/iscsi/icl_soft_proxy.c
index 905e3b7fb25e..fdfeb48081f5 100644
--- a/sys/dev/iscsi/icl_soft_proxy.c
+++ b/sys/dev/iscsi/icl_soft_proxy.c
@@ -74,9 +74,11 @@ __FBSDID("$FreeBSD$");
#include <sys/capsicum.h>
#include <sys/condvar.h>
#include <sys/conf.h>
+#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
diff --git a/sys/dev/iscsi_initiator/iscsivar.h b/sys/dev/iscsi_initiator/iscsivar.h
index 2b70d815a382..6e076b362735 100644
--- a/sys/dev/iscsi_initiator/iscsivar.h
+++ b/sys/dev/iscsi_initiator/iscsivar.h
@@ -31,6 +31,9 @@
/*
| $Id: iscsivar.h 743 2009-08-08 10:54:53Z danny $
*/
+#include <sys/lock.h>
+#include <sys/mutex.h>
+
#define ISCSI_MAX_LUNS 128 // don't touch this
#if ISCSI_MAX_LUNS > 8
/*
diff --git a/sys/dev/iwm/if_iwm_notif_wait.c b/sys/dev/iwm/if_iwm_notif_wait.c
index 71061d740c52..47f02a6cfea7 100644
--- a/sys/dev/iwm/if_iwm_notif_wait.c
+++ b/sys/dev/iwm/if_iwm_notif_wait.c
@@ -76,8 +76,9 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/queue.h>
#include <dev/iwm/if_iwm_notif_wait.h>
diff --git a/sys/dev/led/led.c b/sys/dev/led/led.c
index e361646750cf..c57be67c0e9f 100644
--- a/sys/dev/led/led.c
+++ b/sys/dev/led/led.c
@@ -15,16 +15,19 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/conf.h>
+#include <sys/ctype.h>
#include <sys/kernel.h>
-#include <sys/systm.h>
#include <sys/limits.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
-#include <sys/ctype.h>
-#include <sys/sbuf.h>
+#include <sys/mutex.h>
#include <sys/queue.h>
-#include <dev/led/led.h>
-#include <sys/uio.h>
+#include <sys/sbuf.h>
#include <sys/sx.h>
+#include <sys/systm.h>
+#include <sys/uio.h>
+
+#include <dev/led/led.h>
struct ledsc {
LIST_ENTRY(ledsc) list;
diff --git a/sys/dev/liquidio/lio_bsd.h b/sys/dev/liquidio/lio_bsd.h
index 4d07f210d26c..ac170c9c654f 100644
--- a/sys/dev/liquidio/lio_bsd.h
+++ b/sys/dev/liquidio/lio_bsd.h
@@ -36,6 +36,7 @@
#define __LIO_BSD_H__
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/socket.h>
#include <sys/kernel.h>
#include <sys/module.h>
diff --git a/sys/dev/mfi/mfi_disk.c b/sys/dev/mfi/mfi_disk.c
index 086da9f8599c..016d3f99e9ad 100644
--- a/sys/dev/mfi/mfi_disk.c
+++ b/sys/dev/mfi/mfi_disk.c
@@ -32,18 +32,20 @@ __FBSDID("$FreeBSD$");
#include "opt_mfi.h"
#include <sys/param.h>
-#include <sys/systm.h>
+#include <sys/bio.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/disk.h>
#include <sys/kernel.h>
-#include <sys/selinfo.h>
-#include <sys/module.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/selinfo.h>
#include <sys/sysctl.h>
+#include <sys/systm.h>
#include <sys/uio.h>
-#include <sys/bio.h>
-#include <sys/bus.h>
-#include <sys/conf.h>
-#include <sys/disk.h>
#include <geom/geom_disk.h>
#include <vm/vm.h>
diff --git a/sys/dev/mfi/mfi_pci.c b/sys/dev/mfi/mfi_pci.c
index ee609b328990..f473a30f3f7f 100644
--- a/sys/dev/mfi/mfi_pci.c
+++ b/sys/dev/mfi/mfi_pci.c
@@ -60,15 +60,18 @@ __FBSDID("$FreeBSD$");
#include "opt_mfi.h"
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/selinfo.h>
-#include <sys/module.h>
+#include <sys/bio.h>
#include <sys/bus.h>
#include <sys/conf.h>
-#include <sys/bio.h>
+#include <sys/eventhandler.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/module.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
+#include <sys/selinfo.h>
#include <sys/sysctl.h>
+#include <sys/systm.h>
#include <sys/uio.h>
#include <machine/bus.h>
diff --git a/sys/dev/mfi/mfi_syspd.c b/sys/dev/mfi/mfi_syspd.c
index 0418abf356d0..ba090e744ee1 100644
--- a/sys/dev/mfi/mfi_syspd.c
+++ b/sys/dev/mfi/mfi_syspd.c
@@ -39,9 +39,11 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
-#include <sys/selinfo.h>
+#include <sys/lock.h>
#include <sys/module.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
+#include <sys/selinfo.h>
#include <sys/sysctl.h>
#include <sys/uio.h>
diff --git a/sys/dev/mlx/mlxvar.h b/sys/dev/mlx/mlxvar.h
index cb752557e7bc..4db328f72b4b 100644
--- a/sys/dev/mlx/mlxvar.h
+++ b/sys/dev/mlx/mlxvar.h
@@ -28,6 +28,9 @@
* $FreeBSD$
*/
+#include <sys/lock.h>
+#include <sys/mutex.h>
+
/*
* Debugging levels:
* 0 - quiet, only emit warnings
diff --git a/sys/dev/mmc/host/dwmmc.c b/sys/dev/mmc/host/dwmmc.c
index 38ec1b284172..d9e38071defe 100644
--- a/sys/dev/mmc/host/dwmmc.c
+++ b/sys/dev/mmc/host/dwmmc.c
@@ -40,8 +40,10 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <dev/mmc/bridge.h>
diff --git a/sys/dev/mpr/mprvar.h b/sys/dev/mpr/mprvar.h
index 1a0c2aca779e..92d1dcfeddb0 100644
--- a/sys/dev/mpr/mprvar.h
+++ b/sys/dev/mpr/mprvar.h
@@ -34,6 +34,9 @@
#ifndef _MPRVAR_H
#define _MPRVAR_H
+#include <sys/lock.h>
+#include <sys/mutex.h>
+
#define MPR_DRIVER_VERSION "23.00.00.00-fbsd"
#define MPR_DB_MAX_WAIT 2500
diff --git a/sys/dev/mps/mpsvar.h b/sys/dev/mps/mpsvar.h
index cb173ab3aa59..4a899bf31798 100644
--- a/sys/dev/mps/mpsvar.h
+++ b/sys/dev/mps/mpsvar.h
@@ -35,6 +35,9 @@
#ifndef _MPSVAR_H
#define _MPSVAR_H
+#include <sys/lock.h>
+#include <sys/mutex.h>
+
#define MPS_DRIVER_VERSION "21.02.00.00-fbsd"
#define MPS_DB_MAX_WAIT 2500
diff --git a/sys/dev/mrsas/mrsas.h b/sys/dev/mrsas/mrsas.h
index 50b67f0ca50d..09a52d2acb3f 100644
--- a/sys/dev/mrsas/mrsas.h
+++ b/sys/dev/mrsas/mrsas.h
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <sys/types.h>
#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/sema.h>
#include <sys/sysctl.h>
#include <sys/stat.h>
diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c
index 74b5c1203596..19402f8c946b 100644
--- a/sys/dev/nmdm/nmdm.c
+++ b/sys/dev/nmdm/nmdm.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/tty.h>
#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/poll.h>
#include <sys/kernel.h>
diff --git a/sys/dev/ntb/if_ntb/if_ntb.c b/sys/dev/ntb/if_ntb/if_ntb.c
index ebe9da0de536..3bae01aae49d 100644
--- a/sys/dev/ntb/if_ntb/if_ntb.c
+++ b/sys/dev/ntb/if_ntb/if_ntb.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/buf_ring.h>
#include <sys/bus.h>
+#include <sys/ktr.h>
#include <sys/limits.h>
#include <sys/module.h>
#include <sys/socket.h>
diff --git a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
index d61f664d8cff..05348fe59d2b 100644
--- a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
+++ b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/endian.h>
#include <sys/interrupt.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
diff --git a/sys/dev/ow/ow.c b/sys/dev/ow/ow.c
index 66db4b7ffc81..facb24400aef 100644
--- a/sys/dev/ow/ow.c
+++ b/sys/dev/ow/ow.c
@@ -34,8 +34,10 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/errno.h>
#include <sys/libkern.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <dev/ow/ow.h>
#include <dev/ow/owll.h>
diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c
index f231ab9d69dd..65147341a9bc 100644
--- a/sys/dev/pccard/pccard.c
+++ b/sys/dev/pccard/pccard.c
@@ -35,14 +35,15 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
-#include <sys/kernel.h>
+#include <sys/mutex.h>
#include <sys/queue.h>
#include <sys/sbuf.h>
#include <sys/sysctl.h>
-#include <sys/types.h>
+#include <sys/systm.h>
#include <sys/bus.h>
#include <machine/bus.h>
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 79e07ac466ce..6b54b3db2d10 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -35,17 +35,18 @@ __FBSDID("$FreeBSD$");
#include "opt_bus.h"
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
-#include <sys/limits.h>
-#include <sys/linker.h>
-#include <sys/fcntl.h>
#include <sys/conf.h>
+#include <sys/endian.h>
+#include <sys/eventhandler.h>
+#include <sys/fcntl.h>
#include <sys/kernel.h>
+#include <sys/limits.h>
+#include <sys/linker.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
-#include <sys/endian.h>
+#include <sys/systm.h>
#include <vm/vm.h>
#include <vm/pmap.h>
diff --git a/sys/dev/pci/pci_iov.c b/sys/dev/pci/pci_iov.c
index db8a035f21aa..7ce50c5994fb 100644
--- a/sys/dev/pci/pci_iov.c
+++ b/sys/dev/pci/pci_iov.c
@@ -38,8 +38,10 @@ __FBSDID("$FreeBSD$");
#include <sys/ioccom.h>
#include <sys/iov.h>
#include <sys/linker.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/pciio.h>
#include <sys/queue.h>
#include <sys/rman.h>
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index 36d643a25f78..2f71a1226615 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -42,8 +42,10 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/pciio.h>
#include <sys/rman.h>
#include <sys/sysctl.h>
diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h
index d2f8ce32dc9c..0ade0b5ef61d 100644
--- a/sys/dev/pci/pcivar.h
+++ b/sys/dev/pci/pcivar.h
@@ -33,7 +33,7 @@
#define _PCIVAR_H_
#include <sys/queue.h>
-#include <sys/eventhandler.h>
+#include <sys/_eventhandler.h>
/* some PCI bus constants */
#define PCI_MAXMAPS_0 6 /* max. no. of memory/port maps */
diff --git a/sys/dev/scc/scc_core.c b/sys/dev/scc/scc_core.c
index a4971f8039a9..b5a8fe4fda19 100644
--- a/sys/dev/scc/scc_core.c
+++ b/sys/dev/scc/scc_core.c
@@ -33,8 +33,10 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/conf.h>
+#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/queue.h>
#include <sys/serial.h>
diff --git a/sys/dev/scc/scc_dev_quicc.c b/sys/dev/scc/scc_dev_quicc.c
index 9c372e8e33c4..b73402a90941 100644
--- a/sys/dev/scc/scc_dev_quicc.c
+++ b/sys/dev/scc/scc_dev_quicc.c
@@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/conf.h>
#include <machine/bus.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/serial.h>
diff --git a/sys/dev/scc/scc_dev_sab82532.c b/sys/dev/scc/scc_dev_sab82532.c
index 2885c7152e30..9bf02198552f 100644
--- a/sys/dev/scc/scc_dev_sab82532.c
+++ b/sys/dev/scc/scc_dev_sab82532.c
@@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/conf.h>
#include <machine/bus.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/serial.h>
diff --git a/sys/dev/scc/scc_dev_z8530.c b/sys/dev/scc/scc_dev_z8530.c
index da070dfc7922..193ed7184e86 100644
--- a/sys/dev/scc/scc_dev_z8530.c
+++ b/sys/dev/scc/scc_dev_z8530.c
@@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/conf.h>
#include <machine/bus.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/serial.h>
diff --git a/sys/dev/smartpqi/smartpqi_includes.h b/sys/dev/smartpqi/smartpqi_includes.h
index dd8ffbb2daeb..52ea34a49565 100644
--- a/sys/dev/smartpqi/smartpqi_includes.h
+++ b/sys/dev/smartpqi/smartpqi_includes.h
@@ -37,8 +37,7 @@
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/disk.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
+#include <sys/eventhandler.h>
#include <sys/malloc.h>
#include <sys/rman.h>
#include <sys/bus.h>
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
index da355bf7ff33..829ffcf6b721 100644
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -40,6 +40,7 @@
#ifdef _KERNEL
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/eventhandler.h>
#include <sys/ioccom.h>
#include <sys/filio.h>
#include <sys/sockio.h>
diff --git a/sys/dev/tws/tws.h b/sys/dev/tws/tws.h
index 5ed3fadb4a05..f6d178e13661 100644
--- a/sys/dev/tws/tws.h
+++ b/sys/dev/tws/tws.h
@@ -37,16 +37,17 @@
*/
#include <sys/param.h> /* defines used in kernel.h */
-#include <sys/module.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
+#include <sys/bus.h> /* structs, prototypes for pci bus stuff */
+#include <sys/conf.h> /* cdevsw struct */
#include <sys/errno.h>
#include <sys/kernel.h> /* types used in module initialization */
-#include <sys/conf.h> /* cdevsw struct */
-#include <sys/uio.h> /* uio struct */
+#include <sys/lock.h>
#include <sys/malloc.h>
-#include <sys/bus.h> /* structs, prototypes for pci bus stuff */
-
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/uio.h> /* uio struct */
#include <machine/bus.h>
#include <sys/rman.h>
diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c
index 584dbf9dc8bd..c5d0233c0258 100644
--- a/sys/dev/usb/net/if_cdce.c
+++ b/sys/dev/usb/net/if_cdce.c
@@ -50,11 +50,11 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/stdint.h>
#include <sys/stddef.h>
-#include <sys/param.h>
#include <sys/queue.h>
-#include <sys/types.h>
#include <sys/systm.h>
#include <sys/socket.h>
#include <sys/kernel.h>
diff --git a/sys/dev/usb/net/if_usie.c b/sys/dev/usb/net/if_usie.c
index 9a809cd96d42..a6e9c62f2537 100644
--- a/sys/dev/usb/net/if_usie.c
+++ b/sys/dev/usb/net/if_usie.c
@@ -31,6 +31,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/systm.h>
#include <sys/queue.h>
#include <sys/systm.h>
diff --git a/sys/dev/usb/net/uhso.c b/sys/dev/usb/net/uhso.c
index fb67fc15543e..8e826fd9e6a7 100644
--- a/sys/dev/usb/net/uhso.c
+++ b/sys/dev/usb/net/uhso.c
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/types.h>
+#include <sys/eventhandler.h>
#include <sys/sockio.h>
#include <sys/mbuf.h>
#include <sys/malloc.h>
diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c
index cce87c389de6..bff097831be9 100644
--- a/sys/dev/usb/serial/u3g.c
+++ b/sys/dev/usb/serial/u3g.c
@@ -31,11 +31,11 @@
*/
+#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/stdint.h>
#include <sys/stddef.h>
-#include <sys/param.h>
#include <sys/queue.h>
-#include <sys/types.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
index 3f6dcda67543..14b9d8f54a0b 100644
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -32,8 +32,8 @@
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/queue.h>
-#include <sys/types.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h
index d5648c0301ea..0a393844511d 100644
--- a/sys/dev/usb/usbdi.h
+++ b/sys/dev/usb/usbdi.h
@@ -105,7 +105,7 @@ typedef void (usb_fifo_filter_t)(struct usb_fifo *fifo, struct usb_mbuf *m);
/* USB events */
#ifndef USB_GLOBAL_INCLUDE_FILE
-#include <sys/eventhandler.h>
+#include <sys/_eventhandler.h>
#endif
typedef void (*usb_dev_configured_t)(void *, struct usb_device *,
struct usb_attach_arg *);
diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c
index 7b2bd0d51f24..26872b309e31 100644
--- a/sys/dev/usb/wlan/if_run.c
+++ b/sys/dev/usb/wlan/if_run.c
@@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$");
#include "opt_wlan.h"
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
#include <sys/lock.h>
diff --git a/sys/dev/viawd/viawd.c b/sys/dev/viawd/viawd.c
index 95a4a1111780..ab99f6fb2e5c 100644
--- a/sys/dev/viawd/viawd.c
+++ b/sys/dev/viawd/viawd.c
@@ -30,6 +30,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/systm.h>
diff --git a/sys/dev/vkbd/vkbd.c b/sys/dev/vkbd/vkbd.c
index 61695fa7725d..59ae678f825a 100644
--- a/sys/dev/vkbd/vkbd.c
+++ b/sys/dev/vkbd/vkbd.c
@@ -37,6 +37,7 @@
#include <sys/param.h>
#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/kbio.h>
#include <sys/kernel.h>
diff --git a/sys/dev/vmware/vmci/vmci.c b/sys/dev/vmware/vmci/vmci.c
index dc029419e20d..d2e6f9b30e01 100644
--- a/sys/dev/vmware/vmci/vmci.c
+++ b/sys/dev/vmware/vmci/vmci.c
@@ -9,7 +9,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/types.h>
+#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
diff --git a/sys/dev/vt/vt_cpulogos.c b/sys/dev/vt/vt_cpulogos.c
index 847cf40228b4..33c6d67da0b7 100644
--- a/sys/dev/vt/vt_cpulogos.c
+++ b/sys/dev/vt/vt_cpulogos.c
@@ -30,7 +30,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/callout.h>
#include <sys/cons.h>
+#include <sys/lock.h>
#include <sys/kernel.h>
+#include <sys/mutex.h>
#include <sys/smp.h>
#include <sys/systm.h>
#include <sys/terminal.h>
diff --git a/sys/dev/vt/vt_sysmouse.c b/sys/dev/vt/vt_sysmouse.c
index 98915c2a78df..e10ac829abf3 100644
--- a/sys/dev/vt/vt_sysmouse.c
+++ b/sys/dev/vt/vt_sysmouse.c
@@ -42,8 +42,10 @@ __FBSDID("$FreeBSD$");
#include <sys/consio.h>
#include <sys/fcntl.h>
#include <sys/filio.h>
+#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/poll.h>
#include <sys/random.h>
#include <sys/selinfo.h>
diff --git a/sys/dev/watchdog/watchdog.c b/sys/dev/watchdog/watchdog.c
index 44e2aaad1a33..c5756d6ecc77 100644
--- a/sys/dev/watchdog/watchdog.c
+++ b/sys/dev/watchdog/watchdog.c
@@ -36,18 +36,19 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/conf.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
+#include <sys/eventhandler.h>
#include <sys/kdb.h>
+#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
+#include <sys/systm.h>
+#include <sys/uio.h>
#include <sys/watchdog.h>
-#include <sys/bus.h>
#include <machine/bus.h>
#include <sys/syscallsubr.h> /* kern_clock_gettime() */
diff --git a/sys/dev/xdma/xdma.c b/sys/dev/xdma/xdma.c
index b2933cfe5f11..839e62c63a11 100644
--- a/sys/dev/xdma/xdma.c
+++ b/sys/dev/xdma/xdma.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/limits.h>
#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
diff --git a/sys/dev/xdma/xdma_bank.c b/sys/dev/xdma/xdma_bank.c
index dc59ba8a7d44..14cab1224b95 100644
--- a/sys/dev/xdma/xdma_bank.c
+++ b/sys/dev/xdma/xdma_bank.c
@@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
diff --git a/sys/dev/xdma/xdma_bio.c b/sys/dev/xdma/xdma_bio.c
index dd8fd1d06b83..c994bd5f7629 100644
--- a/sys/dev/xdma/xdma_bio.c
+++ b/sys/dev/xdma/xdma_bio.c
@@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
diff --git a/sys/dev/xdma/xdma_mbuf.c b/sys/dev/xdma/xdma_mbuf.c
index a8035aeee56d..58fab199803b 100644
--- a/sys/dev/xdma/xdma_mbuf.c
+++ b/sys/dev/xdma/xdma_mbuf.c
@@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/mbuf.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
diff --git a/sys/dev/xdma/xdma_queue.c b/sys/dev/xdma/xdma_queue.c
index 82ba831533e7..8e8f932fc8de 100644
--- a/sys/dev/xdma/xdma_queue.c
+++ b/sys/dev/xdma/xdma_queue.c
@@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
diff --git a/sys/dev/xdma/xdma_sg.c b/sys/dev/xdma/xdma_sg.c
index b8e050536313..a78ca5b8d2b3 100644
--- a/sys/dev/xdma/xdma_sg.c
+++ b/sys/dev/xdma/xdma_sg.c
@@ -37,13 +37,16 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
+#include <sys/mutex.h>
#include <sys/rwlock.h>
#include <machine/bus.h>
#include <vm/vm.h>
+#include <vm/pmap.h>
#include <vm/vm_extern.h>
#include <vm/vm_page.h>
diff --git a/sys/dev/xen/console/xen_console.c b/sys/dev/xen/console/xen_console.c
index 97ad2af7471c..e61795a6317c 100644
--- a/sys/dev/xen/console/xen_console.c
+++ b/sys/dev/xen/console/xen_console.c
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/module.h>
#include <sys/systm.h>
+#include <sys/eventhandler.h>
#include <sys/consio.h>
#include <sys/priv.h>
#include <sys/proc.h>
diff --git a/sys/dev/xen/debug/debug.c b/sys/dev/xen/debug/debug.c
index 31bb70979cf9..269d46d46afa 100644
--- a/sys/dev/xen/debug/debug.c
+++ b/sys/dev/xen/debug/debug.c
@@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/pcpu.h>
#include <sys/smp.h>
#include <sys/stack.h>
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index c046c4e88ad3..a3bfdb11efaa 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -45,6 +45,7 @@
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/dirent.h>
+#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/filedesc.h>
diff --git a/sys/i386/i386/elan-mmcr.c b/sys/i386/i386/elan-mmcr.c
index a26e226ba476..81b573c27f0c 100644
--- a/sys/i386/i386/elan-mmcr.c
+++ b/sys/i386/i386/elan-mmcr.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/timetc.h>
diff --git a/sys/i386/i386/geode.c b/sys/i386/i386/geode.c
index c5a2b8e533d0..7d4faefdf70e 100644
--- a/sys/i386/i386/geode.c
+++ b/sys/i386/i386/geode.c
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/timetc.h>
#include <sys/bus.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/watchdog.h>
diff --git a/sys/i386/i386/longrun.c b/sys/i386/i386/longrun.c
index d298ba06bacf..bb403970a27e 100644
--- a/sys/i386/i386/longrun.c
+++ b/sys/i386/i386/longrun.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/power.h>
#include <sys/sysctl.h>
#include <sys/types.h>
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m
index ef47f0fb59b4..b14fb8a05e38 100644
--- a/sys/kern/bus_if.m
+++ b/sys/kern/bus_if.m
@@ -856,7 +856,7 @@ METHOD int get_cpus {
device_t _child;
enum cpu_sets _op;
size_t _setsize;
- cpuset_t *_cpuset;
+ struct _cpuset *_cpuset;
} DEFAULT bus_generic_get_cpus;
/**
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 03a8fc56cb1c..6a18850f1107 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/epoch.h>
+#include <sys/eventhandler.h>
#include <sys/exec.h>
#include <sys/file.h>
#include <sys/filedesc.h>
@@ -160,11 +161,6 @@ SET_DECLARE(sysinit_set, struct sysinit);
struct sysinit **sysinit, **sysinit_end;
struct sysinit **newsysinit, **newsysinit_end;
-EVENTHANDLER_LIST_DECLARE(process_init);
-EVENTHANDLER_LIST_DECLARE(thread_init);
-EVENTHANDLER_LIST_DECLARE(process_ctor);
-EVENTHANDLER_LIST_DECLARE(thread_ctor);
-
/*
* Merge a new sysinit set into the current set, reallocating it if
* necessary. This can only be called after malloc is running.
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index 4f820f3e3453..47cdce455bc3 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/epoch.h>
+#include <sys/eventhandler.h>
#include <sys/gtaskqueue.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 61ec0507e855..56f2f398d043 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -145,8 +145,6 @@ static int map_at_zero = 0;
SYSCTL_INT(_security_bsd, OID_AUTO, map_at_zero, CTLFLAG_RWTUN, &map_at_zero, 0,
"Permit processes to map an object at virtual address 0.");
-EVENTHANDLER_LIST_DECLARE(process_exec);
-
static int
sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS)
{
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 5027182875d5..e805a4362b83 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -99,8 +99,6 @@ SDT_PROBE_DEFINE1(proc, , , exit, "int");
/* Hook for NFS teardown procedure. */
void (*nlminfo_release_p)(struct proc *p);
-EVENTHANDLER_LIST_DECLARE(process_exit);
-
struct proc *
proc_realparent(struct proc *child)
{
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 910bd935822a..78becdba74f9 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -99,8 +99,6 @@ struct fork_args {
};
#endif
-EVENTHANDLER_LIST_DECLARE(process_fork);
-
/* ARGSUSED */
int
sys_fork(struct thread *td, struct fork_args *uap)
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index cc110a9408c2..14a740332e59 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -155,9 +155,6 @@ EVENTHANDLER_LIST_DEFINE(process_exit);
EVENTHANDLER_LIST_DEFINE(process_fork);
EVENTHANDLER_LIST_DEFINE(process_exec);
-EVENTHANDLER_LIST_DECLARE(thread_ctor);
-EVENTHANDLER_LIST_DECLARE(thread_dtor);
-
int kstack_pages = KSTACK_PAGES;
SYSCTL_INT(_kern, OID_AUTO, kstack_pages, CTLFLAG_RD, &kstack_pages, 0,
"Kernel stack size in pages");
diff --git a/sys/kern/subr_bus_dma.c b/sys/kern/subr_bus_dma.c
index 01341bdcb311..dbfd66bd2300 100644
--- a/sys/kern/subr_bus_dma.c
+++ b/sys/kern/subr_bus_dma.c
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bio.h>
#include <sys/bus.h>
#include <sys/callout.h>
+#include <sys/ktr.h>
#include <sys/mbuf.h>
#include <sys/memdesc.h>
#include <sys/proc.h>
diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c
index f3724880c959..a2f82333d457 100644
--- a/sys/kern/subr_intr.c
+++ b/sys/kern/subr_intr.c
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/syslog.h>
#include <sys/malloc.h>
#include <sys/proc.h>
diff --git a/sys/kern/subr_power.c b/sys/kern/subr_power.c
index 7b7371f82f3e..2b9e02b820ac 100644
--- a/sys/kern/subr_power.c
+++ b/sys/kern/subr_power.c
@@ -30,10 +30,10 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-
+#include <sys/eventhandler.h>
#include <sys/power.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
#include <sys/taskqueue.h>
static u_int power_pm_type = POWER_PM_TYPE_NONE;
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c
index b59efb6cb94b..c10dac907498 100644
--- a/sys/kern/tty_tty.c
+++ b/sys/kern/tty_tty.c
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/eventhandler.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/proc.h>
diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c
index 200015b4d016..ece960e6be81 100644
--- a/sys/kern/vfs_mountroot.c
+++ b/sys/kern/vfs_mountroot.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/cons.h>
+#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/jail.h>
#include <sys/kernel.h>
diff --git a/sys/mips/atheros/ar71xx_machdep.c b/sys/mips/atheros/ar71xx_machdep.c
index c4ab2c1aaf77..56a1b054995b 100644
--- a/sys/mips/atheros/ar71xx_machdep.c
+++ b/sys/mips/atheros/ar71xx_machdep.c
@@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/cons.h>
#include <sys/kdb.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/boot.h>
#include <sys/reboot.h>
diff --git a/sys/mips/atheros/ar71xx_wdog.c b/sys/mips/atheros/ar71xx_wdog.c
index 4a51e7f5df83..3944cbbd9a59 100644
--- a/sys/mips/atheros/ar71xx_wdog.c
+++ b/sys/mips/atheros/ar71xx_wdog.c
@@ -35,6 +35,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/systm.h>
#include <sys/watchdog.h>
#include <sys/bus.h>
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index beba6553e6d3..f1b1025a0b63 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -44,15 +44,16 @@ __FBSDID("$FreeBSD$");
#include "opt_ddb.h"
#include "opt_netgraph.h"
-#include <sys/types.h>
#include <sys/param.h>
-#include <sys/lock.h>
-#include <sys/systm.h>
#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/jail.h>
+#include <sys/ktr.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
+#include <sys/mutex.h>
#include <sys/time.h>
#include <sys/priv.h>
#include <sys/proc.h>
@@ -62,6 +63,7 @@ __FBSDID("$FreeBSD$");
#include <sys/ttycom.h>
#include <sys/uio.h>
#include <sys/sysent.h>
+#include <sys/systm.h>
#include <sys/event.h>
#include <sys/file.h>
diff --git a/sys/net/bpf.h b/sys/net/bpf.h
index 92db7aa0d2c3..54bbfd23bba2 100644
--- a/sys/net/bpf.h
+++ b/sys/net/bpf.h
@@ -42,6 +42,7 @@
#ifndef _NET_BPF_H_
#define _NET_BPF_H_
+#include <sys/_eventhandler.h>
#include <sys/ck.h>
#include <net/dlt.h>
@@ -465,12 +466,10 @@ bpf_peers_present(struct bpf_if *bpf)
*/
#define BPF_MEMWORDS 16
-#ifdef _SYS_EVENTHANDLER_H_
/* BPF attach/detach events */
struct ifnet;
typedef void (*bpf_track_fn)(void *, struct ifnet *, int /* dlt */,
int /* 1 =>'s attach */);
EVENTHANDLER_DECLARE(bpf_track, bpf_track_fn);
-#endif /* _SYS_EVENTHANDLER_H_ */
#endif /* _NET_BPF_H_ */
diff --git a/sys/net/bpf_buffer.c b/sys/net/bpf_buffer.c
index 29c25301d048..4a1310f4ce4f 100644
--- a/sys/net/bpf_buffer.c
+++ b/sys/net/bpf_buffer.c
@@ -69,8 +69,10 @@ __FBSDID("$FreeBSD$");
#include "opt_bpf.h"
#include <sys/param.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
+#include <sys/mutex.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/kernel.h>
diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h
index 0753e31d3233..7ceb9b80c116 100644
--- a/sys/net/ethernet.h
+++ b/sys/net/ethernet.h
@@ -401,6 +401,8 @@ struct ether_vlan_header {
#ifdef _KERNEL
+#include <sys/_eventhandler.h>
+
struct ifnet;
struct mbuf;
struct route;
@@ -424,11 +426,9 @@ bool ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p,
uint16_t vid, uint8_t pcp);
void ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr);
-#ifdef _SYS_EVENTHANDLER_H_
/* new ethernet interface attached event */
typedef void (*ether_ifattach_event_handler_t)(void *, struct ifnet *);
EVENTHANDLER_DECLARE(ether_ifattach_event, ether_ifattach_event_handler_t);
-#endif
#else /* _KERNEL */
diff --git a/sys/net/if.c b/sys/net/if.c
index 2a1edfe4d2c5..6dde21047a27 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -36,8 +36,8 @@
#include "opt_inet.h"
#include <sys/param.h>
-#include <sys/types.h>
#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/malloc.h>
#include <sys/domainset.h>
#include <sys/sbuf.h>
diff --git a/sys/net/if_clone.h b/sys/net/if_clone.h
index 5dceacf68e0f..30d604f3b4d6 100644
--- a/sys/net/if_clone.h
+++ b/sys/net/if_clone.h
@@ -37,6 +37,8 @@
#ifdef _KERNEL
+#include <sys/_eventhandler.h>
+
#define IFC_NOGROUP 0x1
struct if_clone;
@@ -65,11 +67,9 @@ const char *ifc_name(struct if_clone *);
void ifc_flags_set(struct if_clone *, int flags);
int ifc_flags_get(struct if_clone *);
-#ifdef _SYS_EVENTHANDLER_H_
/* Interface clone event. */
typedef void (*if_clone_event_handler_t)(void *, struct if_clone *);
EVENTHANDLER_DECLARE(if_clone_event, if_clone_event_handler_t);
-#endif
/* The below interfaces used only by net/if.c. */
void vnet_if_clone_init(void);
diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c
index c5cdcdf2724d..71e2c3ab9a52 100644
--- a/sys/net/if_llatbl.c
+++ b/sys/net/if_llatbl.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/eventhandler.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/syslog.h>
diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h
index 74301284c33e..7bf57bdbd98a 100644
--- a/sys/net/if_llatbl.h
+++ b/sys/net/if_llatbl.h
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#ifndef _NET_IF_LLATBL_H_
#define _NET_IF_LLATBL_H_
+#include <sys/_eventhandler.h>
#include <sys/_rwlock.h>
#include <netinet/in.h>
#include <sys/epoch.h>
@@ -267,7 +268,6 @@ llentry_mark_used(struct llentry *lle)
int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *);
-#include <sys/eventhandler.h>
enum {
LLENTRY_RESOLVED,
LLENTRY_TIMEDOUT,
diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c
index cfe7a898ee1d..0f56208103f0 100644
--- a/sys/net/if_tuntap.c
+++ b/sys/net/if_tuntap.c
@@ -58,6 +58,7 @@
#include <sys/mbuf.h>
#include <sys/module.h>
#include <sys/socket.h>
+#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/filio.h>
#include <sys/sockio.h>
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 6a7cddada492..f6388b147d97 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -73,6 +73,7 @@ struct netmap_adapter;
struct netdump_methods;
#ifdef _KERNEL
+#include <sys/_eventhandler.h>
#include <sys/mbuf.h> /* ifqueue only? */
#include <sys/buf_ring.h>
#include <net/vnet.h>
@@ -421,7 +422,6 @@ void if_maddr_rlock(if_t ifp); /* if_multiaddrs */
void if_maddr_runlock(if_t ifp); /* if_multiaddrs */
#ifdef _KERNEL
-#ifdef _SYS_EVENTHANDLER_H_
/* interface link layer address change event */
typedef void (*iflladdr_event_handler_t)(void *, struct ifnet *);
EVENTHANDLER_DECLARE(iflladdr_event, iflladdr_event_handler_t);
@@ -449,7 +449,6 @@ EVENTHANDLER_DECLARE(ifnet_link_event, ifnet_link_event_handler_t);
typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event);
EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn);
-#endif /* _SYS_EVENTHANDLER_H_ */
/*
* interface groups
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h
index 0b66ec0a0a1e..28b0fa73b8ee 100644
--- a/sys/net/if_vlan_var.h
+++ b/sys/net/if_vlan_var.h
@@ -150,13 +150,13 @@ extern int (*vlan_pcp_p)(struct ifnet *, uint16_t *);
extern int (*vlan_setcookie_p)(struct ifnet *, void *);
extern void *(*vlan_cookie_p)(struct ifnet *);
-#ifdef _SYS_EVENTHANDLER_H_
+#include <sys/_eventhandler.h>
+
/* VLAN state change events */
typedef void (*vlan_config_fn)(void *, struct ifnet *, uint16_t);
typedef void (*vlan_unconfig_fn)(void *, struct ifnet *, uint16_t);
EVENTHANDLER_DECLARE(vlan_config, vlan_config_fn);
EVENTHANDLER_DECLARE(vlan_unconfig, vlan_unconfig_fn);
-#endif /* _SYS_EVENTHANDLER_H_ */
#endif /* _KERNEL */
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index a623d2bb0dde..0c85349f88a8 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/queue.h>
diff --git a/sys/netinet/tcp_offload.c b/sys/netinet/tcp_offload.c
index f7814769bdfb..7e0bab70e037 100644
--- a/sys/netinet/tcp_offload.c
+++ b/sys/netinet/tcp_offload.c
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/types.h>
+#include <sys/eventhandler.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c
index a8861f420948..5df1968fb3ba 100644
--- a/sys/netinet/toecore.c
+++ b/sys/netinet/toecore.c
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include "opt_inet6.h"
#include <sys/param.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/malloc.h>
diff --git a/sys/netinet/toecore.h b/sys/netinet/toecore.h
index f2374d706869..f8bda614b351 100644
--- a/sys/netinet/toecore.h
+++ b/sys/netinet/toecore.h
@@ -35,6 +35,8 @@
#error "no user-serviceable parts inside"
#endif
+#include <sys/_eventhandler.h>
+
struct tcpopt;
struct tcphdr;
struct in_conninfo;
@@ -108,7 +110,6 @@ struct toedev {
struct tcp_info *);
};
-#include <sys/eventhandler.h>
typedef void (*tcp_offload_listen_start_fn)(void *, struct tcpcb *);
typedef void (*tcp_offload_listen_stop_fn)(void *, struct tcpcb *);
EVENTHANDLER_DECLARE(tcp_offload_listen_start, tcp_offload_listen_start_fn);
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 4ae6f507074e..e359b72cb455 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/eventhandler.h>
#include <sys/callout.h>
#include <sys/lock.h>
#include <sys/malloc.h>
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index bf6da55ace79..cbac0dcb724e 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/eventhandler.h>
#include <sys/malloc.h>
#include <sys/libkern.h>
#include <sys/lock.h>
diff --git a/sys/powerpc/ofw/ofw_machdep.c b/sys/powerpc/ofw/ofw_machdep.c
index ef649e1d9082..0e6c30beb7ac 100644
--- a/sys/powerpc/ofw/ofw_machdep.c
+++ b/sys/powerpc/ofw/ofw_machdep.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/disk.h>
#include <sys/fcntl.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/smp.h>
#include <sys/stat.h>
diff --git a/sys/powerpc/powermac/cpcht.c b/sys/powerpc/powermac/cpcht.c
index ca3e4281d26a..08961e70fceb 100644
--- a/sys/powerpc/powermac/cpcht.c
+++ b/sys/powerpc/powermac/cpcht.c
@@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/pciio.h>
#include <sys/rman.h>
diff --git a/sys/powerpc/powermac/cuda.c b/sys/powerpc/powermac/cuda.c
index 6afb44adb6ad..e1b1f23e2373 100644
--- a/sys/powerpc/powermac/cuda.c
+++ b/sys/powerpc/powermac/cuda.c
@@ -38,7 +38,10 @@ __FBSDID("$FreeBSD$");
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/clock.h>
#include <sys/reboot.h>
diff --git a/sys/powerpc/powermac/pmu.c b/sys/powerpc/powermac/pmu.c
index 501f63b56594..a921e27ef1c4 100644
--- a/sys/powerpc/powermac/pmu.c
+++ b/sys/powerpc/powermac/pmu.c
@@ -36,8 +36,11 @@ __FBSDID("$FreeBSD$");
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/clock.h>
#include <sys/proc.h>
#include <sys/reboot.h>
diff --git a/sys/powerpc/powermac/smu.c b/sys/powerpc/powermac/smu.c
index d70424cb0cdf..edc2e2270011 100644
--- a/sys/powerpc/powermac/smu.c
+++ b/sys/powerpc/powermac/smu.c
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/bus.h>
+#include <sys/eventhandler.h>
#include <sys/systm.h>
#include <sys/module.h>
#include <sys/conf.h>
@@ -40,6 +41,8 @@ __FBSDID("$FreeBSD$");
#include <sys/ctype.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/reboot.h>
#include <sys/rman.h>
#include <sys/sysctl.h>
diff --git a/sys/powerpc/powermac/vcoregpio.c b/sys/powerpc/powermac/vcoregpio.c
index 3c387e5c6716..6430bf5f9862 100644
--- a/sys/powerpc/powermac/vcoregpio.c
+++ b/sys/powerpc/powermac/vcoregpio.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/cpu.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
diff --git a/sys/powerpc/powernv/opal.h b/sys/powerpc/powernv/opal.h
index d0ccc1675cb7..2927a03554dc 100644
--- a/sys/powerpc/powernv/opal.h
+++ b/sys/powerpc/powernv/opal.h
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#include <sys/types.h>
-#include <sys/eventhandler.h>
+#include <sys/_eventhandler.h>
/* Check if OPAL is correctly instantiated. Will try to instantiate it. */
int opal_check(void);
diff --git a/sys/powerpc/powernv/opal_async.c b/sys/powerpc/powernv/opal_async.c
index 1af518f83999..10b3eb5679fd 100644
--- a/sys/powerpc/powernv/opal_async.c
+++ b/sys/powerpc/powernv/opal_async.c
@@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#include <sys/param.h>
-#include <sys/types.h>
+#include <sys/eventhandler.h>
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/vmem.h>
diff --git a/sys/powerpc/powernv/opal_console.c b/sys/powerpc/powernv/opal_console.c
index 03acf8dd1ee7..c2da4c639c56 100644
--- a/sys/powerpc/powernv/opal_console.c
+++ b/sys/powerpc/powernv/opal_console.c
@@ -26,15 +26,16 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/cons.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
-#include <sys/priv.h>
-#include <sys/systm.h>
+#include <sys/lock.h>
#include <sys/module.h>
-#include <sys/types.h>
-#include <sys/conf.h>
-#include <sys/cons.h>
+#include <sys/mutex.h>
+#include <sys/priv.h>
#include <sys/proc.h>
+#include <sys/systm.h>
#include <sys/tty.h>
#include <vm/vm.h>
diff --git a/sys/powerpc/powernv/opal_dev.c b/sys/powerpc/powernv/opal_dev.c
index 81cbddd7b504..860c2fb1cbc1 100644
--- a/sys/powerpc/powernv/opal_dev.c
+++ b/sys/powerpc/powernv/opal_dev.c
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/clock.h>
#include <sys/cpu.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/reboot.h>
diff --git a/sys/powerpc/powernv/opal_flash.c b/sys/powerpc/powernv/opal_flash.c
index 3e45603ce882..e9ba56451b8e 100644
--- a/sys/powerpc/powernv/opal_flash.c
+++ b/sys/powerpc/powernv/opal_flash.c
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
+#include <sys/lock.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/proc.h>
diff --git a/sys/powerpc/powernv/opal_sensor.c b/sys/powerpc/powernv/opal_sensor.c
index f11b9649e9d3..832c6b89f34f 100644
--- a/sys/powerpc/powernv/opal_sensor.c
+++ b/sys/powerpc/powernv/opal_sensor.c
@@ -27,11 +27,12 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
-#include <sys/systm.h>
+#include <sys/lock.h>
#include <sys/module.h>
-#include <sys/types.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
+#include <sys/systm.h>
#include <vm/vm.h>
#include <vm/pmap.h>
diff --git a/sys/powerpc/powernv/xive.c b/sys/powerpc/powernv/xive.c
index 0c1406199ac5..9f5b80a15d10 100644
--- a/sys/powerpc/powernv/xive.c
+++ b/sys/powerpc/powernv/xive.c
@@ -37,7 +37,9 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/endian.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/smp.h>
#include <vm/vm.h>
diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c
index ece0fd84efc5..3bab370554cc 100644
--- a/sys/powerpc/powerpc/cpu.c
+++ b/sys/powerpc/powerpc/cpu.c
@@ -66,6 +66,8 @@
#include <sys/conf.h>
#include <sys/cpu.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
+#include <sys/lock.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
#include <sys/sched.h>
diff --git a/sys/powerpc/powerpc/openpic.c b/sys/powerpc/powerpc/openpic.c
index 8511d5be1f33..752b2c9bf0be 100644
--- a/sys/powerpc/powerpc/openpic.c
+++ b/sys/powerpc/powerpc/openpic.c
@@ -32,6 +32,7 @@
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/proc.h>
#include <sys/rman.h>
#include <sys/sched.h>
diff --git a/sys/powerpc/ps3/ps3bus.c b/sys/powerpc/ps3/ps3bus.c
index 0c59f55d28d3..0aa3ad8d7890 100644
--- a/sys/powerpc/ps3/ps3bus.c
+++ b/sys/powerpc/ps3/ps3bus.c
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/cpu.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/resource.h>
#include <sys/rman.h>
diff --git a/sys/powerpc/pseries/rtas_dev.c b/sys/powerpc/pseries/rtas_dev.c
index 873bdc1e95cc..2ffda9ebabb8 100644
--- a/sys/powerpc/pseries/rtas_dev.c
+++ b/sys/powerpc/pseries/rtas_dev.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/clock.h>
#include <sys/cpu.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/reboot.h>
#include <sys/sysctl.h>
diff --git a/sys/powerpc/pseries/xics.c b/sys/powerpc/pseries/xics.c
index fc9a82dd2b4d..b5b54be90090 100644
--- a/sys/powerpc/pseries/xics.c
+++ b/sys/powerpc/pseries/xics.c
@@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/smp.h>
#include <vm/vm.h>
diff --git a/sys/riscv/riscv/intr_machdep.c b/sys/riscv/riscv/intr_machdep.c
index 7251cb250f0a..40e186e72fc0 100644
--- a/sys/riscv/riscv/intr_machdep.c
+++ b/sys/riscv/riscv/intr_machdep.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/module.h>
#include <sys/cpuset.h>
#include <sys/interrupt.h>
diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c
index 683d890ab1a5..76f5f6ce89af 100644
--- a/sys/riscv/riscv/machdep.c
+++ b/sys/riscv/riscv/machdep.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <sys/imgact.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/limits.h>
#include <sys/linker.h>
#include <sys/msgbuf.h>
diff --git a/sys/riscv/riscv/mp_machdep.c b/sys/riscv/riscv/mp_machdep.c
index ba0f4be53809..3d3dbcc0976e 100644
--- a/sys/riscv/riscv/mp_machdep.c
+++ b/sys/riscv/riscv/mp_machdep.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/cpu.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
diff --git a/sys/security/audit/audit.c b/sys/security/audit/audit.c
index 0ad6b208725d..0c08b8333585 100644
--- a/sys/security/audit/audit.c
+++ b/sys/security/audit/audit.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/condvar.h>
#include <sys/conf.h>
+#include <sys/eventhandler.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/fcntl.h>
diff --git a/sys/security/audit/audit_trigger.c b/sys/security/audit/audit_trigger.c
index 7eb78994c4ed..3ff0ebf60aab 100644
--- a/sys/security/audit/audit_trigger.c
+++ b/sys/security/audit/audit_trigger.c
@@ -32,7 +32,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/systm.h>
diff --git a/sys/sys/_eventhandler.h b/sys/sys/_eventhandler.h
new file mode 100644
index 000000000000..f8f24d2b1533
--- /dev/null
+++ b/sys/sys/_eventhandler.h
@@ -0,0 +1,144 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS__EVENTHANDLER_H_
+#define _SYS__EVENTHANDLER_H_
+
+#include <sys/queue.h>
+
+struct eventhandler_entry {
+ TAILQ_ENTRY(eventhandler_entry) ee_link;
+ int ee_priority;
+#define EHE_DEAD_PRIORITY (-1)
+ void *ee_arg;
+};
+
+typedef struct eventhandler_entry *eventhandler_tag;
+
+/*
+ * You can optionally use the EVENTHANDLER_LIST and EVENTHANDLER_DIRECT macros
+ * to pre-define a symbol for the eventhandler list. This symbol can be used by
+ * EVENTHANDLER_DIRECT_INVOKE, which has the advantage of not needing to do a
+ * locked search of the global list of eventhandler lists. At least
+ * EVENTHANDLER_LIST_DEFINE must be be used for EVENTHANDLER_DIRECT_INVOKE to
+ * work. EVENTHANDLER_LIST_DECLARE is only needed if the call to
+ * EVENTHANDLER_DIRECT_INVOKE is in a different compilation unit from
+ * EVENTHANDLER_LIST_DEFINE. If the events are even relatively high frequency
+ * it is suggested that you directly define a list for them.
+ */
+struct eventhandler_list;
+#define EVENTHANDLER_LIST_DECLARE(name) \
+extern struct eventhandler_list *_eventhandler_list_ ## name \
+
+/*
+ * Event handlers need to be declared, but do not need to be defined. The
+ * declaration must be in scope wherever the handler is to be invoked.
+ */
+#define EVENTHANDLER_DECLARE(name, type) \
+struct eventhandler_entry_ ## name \
+{ \
+ struct eventhandler_entry ee; \
+ type eh_func; \
+}; \
+struct __hack
+
+#endif
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS__EVENTHANDLER_H_
+#define _SYS__EVENTHANDLER_H_
+
+#include <sys/queue.h>
+
+struct eventhandler_entry {
+ TAILQ_ENTRY(eventhandler_entry) ee_link;
+ int ee_priority;
+#define EHE_DEAD_PRIORITY (-1)
+ void *ee_arg;
+};
+
+typedef struct eventhandler_entry *eventhandler_tag;
+
+/*
+ * You can optionally use the EVENTHANDLER_LIST and EVENTHANDLER_DIRECT macros
+ * to pre-define a symbol for the eventhandler list. This symbol can be used by
+ * EVENTHANDLER_DIRECT_INVOKE, which has the advantage of not needing to do a
+ * locked search of the global list of eventhandler lists. At least
+ * EVENTHANDLER_LIST_DEFINE must be be used for EVENTHANDLER_DIRECT_INVOKE to
+ * work. EVENTHANDLER_LIST_DECLARE is only needed if the call to
+ * EVENTHANDLER_DIRECT_INVOKE is in a different compilation unit from
+ * EVENTHANDLER_LIST_DEFINE. If the events are even relatively high frequency
+ * it is suggested that you directly define a list for them.
+ */
+struct eventhandler_list;
+#define EVENTHANDLER_LIST_DECLARE(name) \
+extern struct eventhandler_list *_eventhandler_list_ ## name \
+
+/*
+ * Event handlers need to be declared, but do not need to be defined. The
+ * declaration must be in scope wherever the handler is to be invoked.
+ */
+#define EVENTHANDLER_DECLARE(name, type) \
+struct eventhandler_entry_ ## name \
+{ \
+ struct eventhandler_entry ee; \
+ type eh_func; \
+}; \
+struct __hack
+
+#endif
diff --git a/sys/sys/_lock.h b/sys/sys/_lock.h
index 6a9e4b018067..ea7210f9c71a 100644
--- a/sys/sys/_lock.h
+++ b/sys/sys/_lock.h
@@ -40,4 +40,38 @@ struct lock_object {
struct witness *lo_witness; /* Data for witness. */
};
+#ifdef _KERNEL
+/*
+ * If any of WITNESS, INVARIANTS, or KTR_LOCK KTR tracing has been enabled,
+ * then turn on LOCK_DEBUG. When this option is on, extra debugging
+ * facilities such as tracking the file and line number of lock operations
+ * are enabled. Also, mutex locking operations are not inlined to avoid
+ * bloat from all the extra debugging code. We also have to turn on all the
+ * calling conventions for this debugging code in modules so that modules can
+ * work with both debug and non-debug kernels.
+ */
+#if (defined(KLD_MODULE) && !defined(KLD_TIED)) || defined(WITNESS) || defined(INVARIANTS) || \
+ defined(LOCK_PROFILING) || defined(KTR)
+#define LOCK_DEBUG 1
+#else
+#define LOCK_DEBUG 0
+#endif
+
+/*
+ * In the LOCK_DEBUG case, use the filename and line numbers for debugging
+ * operations. Otherwise, use default values to avoid the unneeded bloat.
+ */
+#if LOCK_DEBUG > 0
+#define LOCK_FILE_LINE_ARG_DEF , const char *file, int line
+#define LOCK_FILE_LINE_ARG , file, line
+#define LOCK_FILE __FILE__
+#define LOCK_LINE __LINE__
+#else
+#define LOCK_FILE_LINE_ARG_DEF
+#define LOCK_FILE_LINE_ARG
+#define LOCK_FILE NULL
+#define LOCK_LINE 0
+#endif
+#endif /* _KERNEL */
+
#endif /* !_SYS__LOCK_H_ */
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index 9c2b92af2983..76ac60498205 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -150,7 +150,7 @@ struct devreq {
#ifdef _KERNEL
-#include <sys/eventhandler.h>
+#include <sys/_eventhandler.h>
#include <sys/kobj.h>
/**
@@ -419,6 +419,8 @@ void root_bus_configure(void);
* Useful functions for implementing buses.
*/
+struct _cpuset;
+
int bus_generic_activate_resource(device_t dev, device_t child, int type,
int rid, struct resource *r);
device_t
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 5741e66c5522..17a01950b0ed 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -43,7 +43,7 @@
#define _SYS_CONF_H_
#ifdef _KERNEL
-#include <sys/eventhandler.h>
+#include <sys/_eventhandler.h>
#else
#include <sys/queue.h>
#endif
diff --git a/sys/sys/cpu.h b/sys/sys/cpu.h
index 8a74e470efcb..7ec7dc9ed9d2 100644
--- a/sys/sys/cpu.h
+++ b/sys/sys/cpu.h
@@ -31,7 +31,7 @@
#ifndef _SYS_CPU_H_
#define _SYS_CPU_H_
-#include <sys/eventhandler.h>
+#include <sys/_eventhandler.h>
/*
* CPU device support.
diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h
index cc4237521d9d..9e3ff019c10a 100644
--- a/sys/sys/eventhandler.h
+++ b/sys/sys/eventhandler.h
@@ -31,18 +31,12 @@
#ifndef _SYS_EVENTHANDLER_H_
#define _SYS_EVENTHANDLER_H_
+#include <sys/_eventhandler.h>
#include <sys/lock.h>
#include <sys/ktr.h>
#include <sys/mutex.h>
#include <sys/queue.h>
-struct eventhandler_entry {
- TAILQ_ENTRY(eventhandler_entry) ee_link;
- int ee_priority;
-#define EHE_DEAD_PRIORITY (-1)
- void *ee_arg;
-};
-
#ifdef VIMAGE
struct eventhandler_entry_vimage {
void (* func)(void); /* Original function registered. */
@@ -60,8 +54,6 @@ struct eventhandler_list {
TAILQ_HEAD(,eventhandler_entry) el_entries;
};
-typedef struct eventhandler_entry *eventhandler_tag;
-
#define EHL_LOCK(p) mtx_lock(&(p)->el_lock)
#define EHL_UNLOCK(p) mtx_unlock(&(p)->el_lock)
#define EHL_LOCK_ASSERT(p, x) mtx_assert(&(p)->el_lock, x)
@@ -107,9 +99,6 @@ typedef struct eventhandler_entry *eventhandler_tag;
* EVENTHANDLER_LIST_DEFINE. If the events are even relatively high frequency
* it is suggested that you directly define a list for them.
*/
-#define EVENTHANDLER_LIST_DECLARE(name) \
-extern struct eventhandler_list *_eventhandler_list_ ## name \
-
#define EVENTHANDLER_LIST_DEFINE(name) \
struct eventhandler_list *_eventhandler_list_ ## name ; \
static void _ehl_init_ ## name (void * ctx __unused) \
@@ -130,18 +119,6 @@ SYSINIT(name ## _ehl_init, SI_SUB_EVENTHANDLER, SI_ORDER_ANY, \
} \
} while (0)
-/*
- * Event handlers need to be declared, but do not need to be defined. The
- * declaration must be in scope wherever the handler is to be invoked.
- */
-#define EVENTHANDLER_DECLARE(name, type) \
-struct eventhandler_entry_ ## name \
-{ \
- struct eventhandler_entry ee; \
- type eh_func; \
-}; \
-struct __hack
-
#define EVENTHANDLER_DEFINE(name, func, arg, priority) \
static eventhandler_tag name ## _tag; \
static void name ## _evh_init(void *ctx) \
diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h
index 66f421eb0265..cf8b7a011de8 100644
--- a/sys/sys/interrupt.h
+++ b/sys/sys/interrupt.h
@@ -176,8 +176,9 @@ int intr_event_add_handler(struct intr_event *ie, const char *name,
int intr_event_bind(struct intr_event *ie, int cpu);
int intr_event_bind_irqonly(struct intr_event *ie, int cpu);
int intr_event_bind_ithread(struct intr_event *ie, int cpu);
+struct _cpuset;
int intr_event_bind_ithread_cpuset(struct intr_event *ie,
- cpuset_t *mask);
+ struct _cpuset *mask);
int intr_event_create(struct intr_event **event, void *source,
int flags, int irq, void (*pre_ithread)(void *),
void (*post_ithread)(void *), void (*post_filter)(void *),
diff --git a/sys/sys/lock.h b/sys/sys/lock.h
index f7e25d278f3b..db2e697e563d 100644
--- a/sys/sys/lock.h
+++ b/sys/sys/lock.h
@@ -119,38 +119,6 @@ struct lock_class {
#ifdef _KERNEL
/*
- * If any of WITNESS, INVARIANTS, or KTR_LOCK KTR tracing has been enabled,
- * then turn on LOCK_DEBUG. When this option is on, extra debugging
- * facilities such as tracking the file and line number of lock operations
- * are enabled. Also, mutex locking operations are not inlined to avoid
- * bloat from all the extra debugging code. We also have to turn on all the
- * calling conventions for this debugging code in modules so that modules can
- * work with both debug and non-debug kernels.
- */
-#if (defined(KLD_MODULE) && !defined(KLD_TIED)) || defined(WITNESS) || defined(INVARIANTS) || \
- defined(LOCK_PROFILING) || defined(KTR)
-#define LOCK_DEBUG 1
-#else
-#define LOCK_DEBUG 0
-#endif
-
-/*
- * In the LOCK_DEBUG case, use the filename and line numbers for debugging
- * operations. Otherwise, use default values to avoid the unneeded bloat.
- */
-#if LOCK_DEBUG > 0
-#define LOCK_FILE_LINE_ARG_DEF , const char *file, int line
-#define LOCK_FILE_LINE_ARG , file, line
-#define LOCK_FILE __FILE__
-#define LOCK_LINE __LINE__
-#else
-#define LOCK_FILE_LINE_ARG_DEF
-#define LOCK_FILE_LINE_ARG
-#define LOCK_FILE NULL
-#define LOCK_LINE 0
-#endif
-
-/*
* Macros for KTR_LOCK tracing.
*
* opname - name of this operation (LOCK/UNLOCK/SLOCK, etc.)
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 2b0622c61195..941342ef03b0 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -60,7 +60,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1300028 /* Master, propagated to newvers */
+#define __FreeBSD_version 1300029 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index 19bc4a8b9076..38785cd26c94 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -39,6 +39,7 @@
#error "no assembler-serviceable parts inside"
#endif
+#include <sys/param.h>
#include <sys/_cpuset.h>
#include <sys/_lock.h>
#include <sys/_mutex.h>
diff --git a/sys/sys/power.h b/sys/sys/power.h
index 3fcc2c387d61..e333a65043bf 100644
--- a/sys/sys/power.h
+++ b/sys/sys/power.h
@@ -31,7 +31,7 @@
#ifndef _SYS_POWER_H_
#define _SYS_POWER_H_
-#include <sys/eventhandler.h>
+#include <sys/_eventhandler.h>
/* Power management system type */
#define POWER_PM_TYPE_APM 0x00
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 4c37b9fb3ff0..a257de430ba7 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -42,6 +42,9 @@
#include <sys/callout.h> /* For struct callout. */
#include <sys/event.h> /* For struct klist. */
+#ifdef _KERNEL
+#include <sys/_eventhandler.h>
+#endif
#include <sys/condvar.h>
#ifndef _KERNEL
#include <sys/filedesc.h>
@@ -1186,6 +1189,18 @@ void proc_id_set(int type, pid_t id);
void proc_id_set_cond(int type, pid_t id);
void proc_id_clear(int type, pid_t id);
+EVENTHANDLER_LIST_DECLARE(process_ctor);
+EVENTHANDLER_LIST_DECLARE(process_dtor);
+EVENTHANDLER_LIST_DECLARE(process_init);
+EVENTHANDLER_LIST_DECLARE(process_fini);
+EVENTHANDLER_LIST_DECLARE(process_exit);
+EVENTHANDLER_LIST_DECLARE(process_fork);
+EVENTHANDLER_LIST_DECLARE(process_exec);
+
+EVENTHANDLER_LIST_DECLARE(thread_ctor);
+EVENTHANDLER_LIST_DECLARE(thread_dtor);
+EVENTHANDLER_LIST_DECLARE(thread_init);
+
#endif /* _KERNEL */
#endif /* !_SYS_PROC_H_ */
diff --git a/sys/sys/watchdog.h b/sys/sys/watchdog.h
index 191456a4acf2..3728d742e4d1 100644
--- a/sys/sys/watchdog.h
+++ b/sys/sys/watchdog.h
@@ -104,7 +104,7 @@
#ifdef _KERNEL
-#include <sys/eventhandler.h>
+#include <sys/_eventhandler.h>
typedef void (*watchdog_fn)(void *, u_int, int *);
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 7d62fc76254b..c56c9d53b342 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -74,20 +74,21 @@ __FBSDID("$FreeBSD$");
#include "opt_vm.h"
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/priv.h>
-#include <sys/proc.h>
#include <sys/bio.h>
+#include <sys/blist.h>
#include <sys/buf.h>
+#include <sys/conf.h>
#include <sys/disk.h>
+#include <sys/eventhandler.h>
#include <sys/fcntl.h>
+#include <sys/lock.h>
+#include <sys/kernel.h>
#include <sys/mount.h>
#include <sys/namei.h>
-#include <sys/vnode.h>
#include <sys/malloc.h>
#include <sys/pctrie.h>
+#include <sys/priv.h>
+#include <sys/proc.h>
#include <sys/racct.h>
#include <sys/resource.h>
#include <sys/resourcevar.h>
@@ -95,10 +96,10 @@ __FBSDID("$FreeBSD$");
#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <sys/sysproto.h>
-#include <sys/blist.h>
-#include <sys/lock.h>
+#include <sys/systm.h>
#include <sys/sx.h>
#include <sys/vmmeter.h>
+#include <sys/vnode.h>
#include <security/mac/mac_framework.h>
diff --git a/sys/x86/acpica/OsdEnvironment.c b/sys/x86/acpica/OsdEnvironment.c
index 27908b165c0b..c9b22f25a28a 100644
--- a/sys/x86/acpica/OsdEnvironment.c
+++ b/sys/x86/acpica/OsdEnvironment.c
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/types.h>
+#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
diff --git a/sys/x86/cpufreq/smist.c b/sys/x86/cpufreq/smist.c
index e68906c4296b..f878ed89494c 100644
--- a/sys/x86/cpufreq/smist.c
+++ b/sys/x86/cpufreq/smist.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/cpu.h>
#include <sys/kernel.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/systm.h>
#include <machine/bus.h>
diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c
index dce1f4db5ce8..ae03ffa14e30 100644
--- a/sys/x86/iommu/intel_drv.c
+++ b/sys/x86/iommu/intel_drv.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/memdesc.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/rwlock.h>
#include <sys/smp.h>
diff --git a/sys/x86/iommu/intel_intrmap.c b/sys/x86/iommu/intel_intrmap.c
index a40ddc3f144a..6ae88243a640 100644
--- a/sys/x86/iommu/intel_intrmap.c
+++ b/sys/x86/iommu/intel_intrmap.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/memdesc.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/rwlock.h>
#include <sys/taskqueue.h>
diff --git a/sys/x86/iommu/intel_quirks.c b/sys/x86/iommu/intel_quirks.c
index 9cebf5cb76c8..a0873ea87cc1 100644
--- a/sys/x86/iommu/intel_quirks.c
+++ b/sys/x86/iommu/intel_quirks.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/memdesc.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/rwlock.h>
#include <sys/smp.h>
diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c
index 26e8b66b0d7a..9ecdcce9bcf3 100644
--- a/sys/x86/x86/tsc.c
+++ b/sys/x86/x86/tsc.c
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/cpu.h>
+#include <sys/eventhandler.h>
#include <sys/limits.h>
#include <sys/malloc.h>
#include <sys/systm.h>