git: 5b56413d04e6 - main - newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANY

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 25 Jul 2024 04:49:04 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=5b56413d04e608379c9a306373554a8e4d321bc0

commit 5b56413d04e608379c9a306373554a8e4d321bc0
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-07-25 04:22:58 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-07-25 04:22:58 +0000

    newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANY
    
    Sponsored by:           Netflix
---
 sys/arm/allwinner/aw_mmc.c                      |   2 +-
 sys/arm/allwinner/aw_rsb.c                      |   2 +-
 sys/arm/arm/gic_acpi.c                          |   2 +-
 sys/arm/arm/gic_fdt.c                           |   2 +-
 sys/arm/broadcom/bcm2835/bcm2835_bsc.c          |   2 +-
 sys/arm/broadcom/bcm2835/bcm2835_spi.c          |   2 +-
 sys/arm/broadcom/bcm2835/bcm2838_pci.c          |   2 +-
 sys/arm/freescale/imx/imx_i2c.c                 |   2 +-
 sys/arm/freescale/imx/imx_spi.c                 |   2 +-
 sys/arm/freescale/vybrid/vf_ehci.c              |   2 +-
 sys/arm/mv/a37x0_iic.c                          |   2 +-
 sys/arm/mv/a37x0_spi.c                          |   2 +-
 sys/arm/mv/mv_pci.c                             |   4 +-
 sys/arm/mv/mv_pci_ctrl.c                        |   2 +-
 sys/arm/mv/mv_spi.c                             |   2 +-
 sys/arm/nvidia/tegra_ehci.c                     |   2 +-
 sys/arm/nvidia/tegra_i2c.c                      |   2 +-
 sys/arm/nvidia/tegra_pcie.c                     |   2 +-
 sys/arm/nvidia/tegra_xhci.c                     |   2 +-
 sys/arm/ti/am335x/am335x_musb.c                 |   2 +-
 sys/arm/ti/am335x/am335x_scm.c                  |   2 +-
 sys/arm/ti/ti_spi.c                             |   2 +-
 sys/arm/ti/usb/omap_ehci.c                      |   2 +-
 sys/arm/xilinx/zy7_ehci.c                       |   2 +-
 sys/arm/xilinx/zy7_qspi.c                       |   2 +-
 sys/arm/xilinx/zy7_spi.c                        |   2 +-
 sys/arm64/arm64/gic_v3_acpi.c                   |   2 +-
 sys/arm64/arm64/gic_v3_fdt.c                    |   2 +-
 sys/arm64/broadcom/brcmmdio/mdio_mux_iproc.c    |   2 +-
 sys/arm64/broadcom/brcmmdio/mdio_nexus_iproc.c  |   2 +-
 sys/arm64/cavium/thunder_pcie_pem.c             |   2 +-
 sys/arm64/rockchip/rk_pcie.c                    |   2 +-
 sys/dev/aac/aac.c                               |   2 +-
 sys/dev/aacraid/aacraid.c                       |   4 +-
 sys/dev/acpica/acpi_video.c                     |   2 +-
 sys/dev/adb/adb_bus.c                           |   2 +-
 sys/dev/agp/agp_i810.c                          |   2 +-
 sys/dev/ahci/ahci.c                             |   6 +-
 sys/dev/alpm/alpm.c                             |   2 +-
 sys/dev/amdpm/amdpm.c                           |   2 +-
 sys/dev/amdsmb/amdsmb.c                         |   2 +-
 sys/dev/amdsmn/amdsmn.c                         |   2 +-
 sys/dev/amdtemp/amdtemp.c                       |   2 +-
 sys/dev/ata/chipsets/ata-jmicron.c              |   2 +-
 sys/dev/ata/chipsets/ata-marvell.c              |   2 +-
 sys/dev/cardbus/cardbus.c                       |   2 +-
 sys/dev/cfi/cfi_core.c                          |   2 +-
 sys/dev/cxgbe/crypto/t4_crypto.c                |   2 +-
 sys/dev/cxgbe/t4_main.c                         |   2 +-
 sys/dev/cxgbe/t4_vf.c                           |   2 +-
 sys/dev/drm2/drm_dp_iic_helper.c                |   2 +-
 sys/dev/etherswitch/miiproxy.c                  |   2 +-
 sys/dev/exca/exca.c                             |   2 +-
 sys/dev/gpio/gpiobus.c                          |   2 +-
 sys/dev/gpio/gpioiic.c                          |   2 +-
 sys/dev/gpio/gpiospi.c                          |   2 +-
 sys/dev/gpio/ofw_gpiobus.c                      |   2 +-
 sys/dev/hyperv/pcib/vmbus_pcib.c                |   2 +-
 sys/dev/hyperv/vmbus/vmbus.c                    |   5 +-
 sys/dev/hyperv/vmbus/vmbus_et.c                 |   2 +-
 sys/dev/ichiic/ig4_iic.c                        |   2 +-
 sys/dev/ida/ida.c                               |   2 +-
 sys/dev/iicbus/controller/opencores/iicoc_fdt.c |   2 +-
 sys/dev/iicbus/controller/opencores/iicoc_pci.c |   2 +-
 sys/dev/iicbus/controller/rockchip/rk_i2c.c     |   2 +-
 sys/dev/iicbus/controller/vybrid/vf_i2c.c       |   2 +-
 sys/dev/iicbus/iicbb.c                          |   2 +-
 sys/dev/iicbus/iichid.c                         |   2 +-
 sys/dev/iicbus/iicsmb.c                         |   2 +-
 sys/dev/iicbus/mux/iicmux.c                     |   4 +-
 sys/dev/iicbus/ofw_iicbus.c                     |   2 +-
 sys/dev/imcsmb/imcsmb.c                         |   2 +-
 sys/dev/imcsmb/imcsmb_pci.c                     |   2 +-
 sys/dev/intel/spi.c                             |   2 +-
 sys/dev/intpm/intpm.c                           |   2 +-
 sys/dev/ips/ips.c                               |   2 +-
 sys/dev/mfi/mfi.c                               |   2 +-
 sys/dev/mge/if_mge.c                            |   2 +-
 sys/dev/mii/mii.c                               |   4 +-
 sys/dev/mlx/mlx.c                               |   2 +-
 sys/dev/mmc/host/dwmmc.c                        |   2 +-
 sys/dev/mmc/mmc.c                               |   2 +-
 sys/dev/msk/if_msk.c                            |   4 +-
 sys/dev/mvs/mvs_pci.c                           |   2 +-
 sys/dev/mvs/mvs_soc.c                           |   2 +-
 sys/dev/neta/if_mvneta.c                        |   2 +-
 sys/dev/nfsmb/nfsmb.c                           |   6 +-
 sys/dev/ntb/ntb.c                               |   2 +-
 sys/dev/ntb/ntb_transport.c                     |   2 +-
 sys/dev/ofw/ofw_cpu.c                           |   2 +-
 sys/dev/ofw/ofw_pcib.c                          |   2 +-
 sys/dev/ow/ow.c                                 |   2 +-
 sys/dev/ow/owc_gpiobus.c                        |   2 +-
 sys/dev/pccbb/pccbb_pci.c                       |   2 +-
 sys/dev/pci/controller/pci_n1sdp.c              |   2 +-
 sys/dev/pci/hostb_pci.c                         |   2 +-
 sys/dev/pci/pci.c                               |   2 +-
 sys/dev/pci/pci_dw.c                            |   2 +-
 sys/dev/pci/pci_host_generic_acpi.c             |   2 +-
 sys/dev/pci/pci_host_generic_fdt.c              |   2 +-
 sys/dev/pci/pci_pci.c                           |   4 +-
 sys/dev/pci/vga_pci.c                           |   2 +-
 sys/dev/ppbus/lpbb.c                            |   2 +-
 sys/dev/ppc/ppc.c                               |   2 +-
 sys/dev/pst/pst-raid.c                          |   2 +-
 sys/dev/puc/puc.c                               |   2 +-
 sys/dev/pwm/controller/allwinner/aw_pwm.c       |   2 +-
 sys/dev/pwm/controller/rockchip/rk_pwm.c        |   2 +-
 sys/dev/quicc/quicc_core.c                      |   2 +-
 sys/dev/rtsx/rtsx.c                             |   2 +-
 sys/dev/scc/scc_core.c                          |   2 +-
 sys/dev/sdhci/sdhci.c                           |   2 +-
 sys/dev/sdio/sdiob.c                            |   2 +-
 sys/dev/siis/siis.c                             |   2 +-
 sys/dev/sk/if_sk.c                              |   4 +-
 sys/dev/sound/pci/csa.c                         |   4 +-
 sys/dev/sound/pci/emu10kx.c                     |  16 +-
 sys/dev/sound/pci/fm801.c                       |   2 +-
 sys/dev/sound/pci/hda/hdaa.c                    |   2 +-
 sys/dev/sound/pci/hda/hdac.c                    |   2 +-
 sys/dev/sound/pci/hda/hdacc.c                   |   2 +-
 sys/dev/sound/pci/hdspe.c                       |   2 +-
 sys/dev/sound/usb/uaudio.c                      |   2 +-
 sys/dev/spibus/controller/allwinner/aw_spi.c    |   2 +-
 sys/dev/spibus/controller/rockchip/rk_spi.c     |   2 +-
 sys/dev/spibus/ofw_spibus.c                     |   2 +-
 sys/dev/usb/controller/dwc3/dwc3.c              |   2 +-
 sys/dev/usb/controller/dwc_otg.c                |   2 +-
 sys/dev/usb/controller/dwc_otg_fdt.c            |   2 +-
 sys/dev/usb/controller/ehci_fsl.c               |   2 +-
 sys/dev/usb/controller/ehci_imx.c               |   2 +-
 sys/dev/usb/controller/ehci_msm.c               |   2 +-
 sys/dev/usb/controller/ehci_mv.c                |   2 +-
 sys/dev/usb/controller/ehci_pci.c               |   2 +-
 sys/dev/usb/controller/generic_ehci.c           |   2 +-
 sys/dev/usb/controller/generic_ohci.c           |   2 +-
 sys/dev/usb/controller/generic_xhci.c           |   2 +-
 sys/dev/usb/controller/musb_otg_allwinner.c     |   2 +-
 sys/dev/usb/controller/ohci_pci.c               |   2 +-
 sys/dev/usb/controller/uhci_pci.c               |   2 +-
 sys/dev/usb/controller/xhci_pci.c               |   2 +-
 sys/dev/usb/input/usbhid.c                      |   2 +-
 sys/dev/usb/misc/cp2112.c                       |   6 +-
 sys/dev/usb/usb_device.c                        |   2 +-
 sys/dev/usb/video/udl.c                         |   2 +-
 sys/dev/viapm/viapm.c                           |   2 +-
 sys/dev/virtio/pci/virtio_pci.c                 |   2 +-
 sys/dev/vmd/vmd.c                               |   3 +-
 sys/dev/vnic/mrml_bridge.c                      |   2 +-
 sys/dev/vnic/thunder_mdio_fdt.c                 |   2 +-
 sys/dev/xen/pcifront/pcifront.c                 | 688 ++++++++++++++++++++++++
 sys/isa/vga_isa.c                               |   2 +-
 sys/powerpc/mpc85xx/fsl_espi.c                  |   2 +-
 sys/powerpc/mpc85xx/i2c.c                       |   2 +-
 sys/powerpc/mpc85xx/lbc.c                       |   2 +-
 sys/powerpc/powermac/atibl.c                    |   2 +-
 sys/powerpc/powermac/cuda.c                     |   2 +-
 sys/powerpc/powermac/kiic.c                     |   2 +-
 sys/powerpc/powermac/macgpio.c                  |   2 +-
 sys/powerpc/powermac/macio.c                    |   2 +-
 sys/powerpc/powermac/nvbl.c                     |   2 +-
 sys/powerpc/powermac/pmu.c                      |   2 +-
 sys/powerpc/powermac/smu.c                      |   4 +-
 sys/powerpc/powermac/uninorth.c                 |   2 +-
 sys/powerpc/powernv/opal_console.c              |   2 +-
 sys/powerpc/powernv/opal_dev.c                  |   2 +-
 sys/powerpc/powernv/opal_i2cm.c                 |   2 +-
 sys/powerpc/powernv/opal_sensor.c               |   2 +-
 sys/powerpc/powernv/powernv_centaur.c           |   2 +-
 sys/powerpc/powernv/powernv_xscom.c             |   2 +-
 sys/powerpc/ps3/ehci_ps3.c                      |   2 +-
 sys/powerpc/ps3/ohci_ps3.c                      |   2 +-
 sys/powerpc/ps3/ps3bus.c                        |   6 +-
 sys/powerpc/pseries/vdevice.c                   |   2 +-
 sys/powerpc/psim/ata_iobus.c                    |   2 +-
 sys/powerpc/psim/iobus.c                        |   2 +-
 sys/riscv/sifive/sifive_spi.c                   |   2 +-
 sys/x86/pci/pci_bus.c                           |   2 +-
 sys/x86/pci/qpi.c                               |   2 +-
 sys/x86/x86/mptable_pci.c                       |   2 +-
 sys/xen/xenbus/xenbusb.c                        |   2 +-
 181 files changed, 894 insertions(+), 206 deletions(-)

diff --git a/sys/arm/allwinner/aw_mmc.c b/sys/arm/allwinner/aw_mmc.c
index 929cbd8f3ed8..634afdfdfd46 100644
--- a/sys/arm/allwinner/aw_mmc.c
+++ b/sys/arm/allwinner/aw_mmc.c
@@ -328,7 +328,7 @@ aw_mmc_helper_cd_handler(device_t dev, bool present)
 			if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CARD))
 				device_printf(sc->aw_dev, "Card inserted\n");
 
-			sc->child = device_add_child(sc->aw_dev, "mmc", -1);
+			sc->child = device_add_child(sc->aw_dev, "mmc", DEVICE_UNIT_ANY);
 			AW_MMC_UNLOCK(sc);
 			if (sc->child) {
 				device_set_ivars(sc->child, sc);
diff --git a/sys/arm/allwinner/aw_rsb.c b/sys/arm/allwinner/aw_rsb.c
index fa599ddcb3dd..6ca6b3acbf8c 100644
--- a/sys/arm/allwinner/aw_rsb.c
+++ b/sys/arm/allwinner/aw_rsb.c
@@ -442,7 +442,7 @@ rsb_attach(device_t dev)
 	/* Set the PMIC into RSB mode as ATF might have leave it in I2C mode */
 	RSB_WRITE(sc, RSB_PMCR, RSB_PMCR_REG(PMIC_MODE_REG) | RSB_PMCR_DATA(PMIC_MODE_RSB) | RSB_PMCR_START);
 
-	sc->iicbus = device_add_child(dev, "iicbus", -1);
+	sc->iicbus = device_add_child(dev, "iicbus", DEVICE_UNIT_ANY);
 	if (sc->iicbus == NULL) {
 		device_printf(dev, "cannot add iicbus child device\n");
 		error = ENXIO;
diff --git a/sys/arm/arm/gic_acpi.c b/sys/arm/arm/gic_acpi.c
index 8b79558da6e8..fa823320dcc9 100644
--- a/sys/arm/arm/gic_acpi.c
+++ b/sys/arm/arm/gic_acpi.c
@@ -280,7 +280,7 @@ madt_gicv2m_handler(ACPI_SUBTABLE_HEADER *entry, void *arg)
 		device_printf(dev, "frame: %x %lx %x %u %u\n", msi->MsiFrameId,
 		    msi->BaseAddress, msi->Flags, msi->SpiCount, msi->SpiBase);
 
-		cdev = device_add_child(dev, NULL, -1);
+		cdev = device_add_child(dev, NULL, DEVICE_UNIT_ANY);
 		if (cdev == NULL)
 			return;
 
diff --git a/sys/arm/arm/gic_fdt.c b/sys/arm/arm/gic_fdt.c
index a8886abf1c18..7ebc4faaa862 100644
--- a/sys/arm/arm/gic_fdt.c
+++ b/sys/arm/arm/gic_fdt.c
@@ -292,7 +292,7 @@ arm_gic_add_children(device_t dev)
 		ofw_bus_reg_to_rl(dev, child, sc->addr_cells,
 		    sc->size_cells, &dinfo->rl);
 
-		cdev = device_add_child(dev, NULL, -1);
+		cdev = device_add_child(dev, NULL, DEVICE_UNIT_ANY);
 		if (cdev == NULL) {
 			device_printf(dev, "<%s>: device_add_child failed\n",
 			    dinfo->obdinfo.obd_name);
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_bsc.c b/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
index 7d14a5c26c4d..6a9853a7b4f9 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
@@ -342,7 +342,7 @@ bcm_bsc_attach(device_t dev)
 	bcm_bsc_reset(sc);
 	BCM_BSC_UNLOCK(sc);
 
-	sc->sc_iicbus = device_add_child(dev, "iicbus", -1);
+	sc->sc_iicbus = device_add_child(dev, "iicbus", DEVICE_UNIT_ANY);
 	if (sc->sc_iicbus == NULL) {
 		bcm_bsc_detach(dev);
 		return (ENXIO);
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_spi.c b/sys/arm/broadcom/bcm2835/bcm2835_spi.c
index fc488e349157..17419be0c8a7 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_spi.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_spi.c
@@ -298,7 +298,7 @@ bcm_spi_attach(device_t dev)
 	bcm_spi_printr(dev);
 #endif
 
-	device_add_child(dev, "spibus", -1);
+	device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
 
 	return (bus_generic_attach(dev));
 }
diff --git a/sys/arm/broadcom/bcm2835/bcm2838_pci.c b/sys/arm/broadcom/bcm2835/bcm2838_pci.c
index f5304525a6fb..0f41dcff37ca 100644
--- a/sys/arm/broadcom/bcm2835/bcm2838_pci.c
+++ b/sys/arm/broadcom/bcm2835/bcm2838_pci.c
@@ -744,7 +744,7 @@ bcm_pcib_attach(device_t dev)
 		return (error);
 
 	/* Done. */
-	device_add_child(dev, "pci", -1);
+	device_add_child(dev, "pci", DEVICE_UNIT_ANY);
 	return (bus_generic_attach(dev));
 }
 
diff --git a/sys/arm/freescale/imx/imx_i2c.c b/sys/arm/freescale/imx/imx_i2c.c
index f8769d29e7f7..d8d7514c8c4b 100644
--- a/sys/arm/freescale/imx/imx_i2c.c
+++ b/sys/arm/freescale/imx/imx_i2c.c
@@ -413,7 +413,7 @@ i2c_attach(device_t dev)
 		return (ENXIO);
 	}
 
-	sc->iicbus = device_add_child(dev, "iicbus", -1);
+	sc->iicbus = device_add_child(dev, "iicbus", DEVICE_UNIT_ANY);
 	if (sc->iicbus == NULL) {
 		device_printf(dev, "could not add iicbus child");
 		return (ENXIO);
diff --git a/sys/arm/freescale/imx/imx_spi.c b/sys/arm/freescale/imx/imx_spi.c
index 0be15aa82771..388b25b7ec28 100644
--- a/sys/arm/freescale/imx/imx_spi.c
+++ b/sys/arm/freescale/imx/imx_spi.c
@@ -563,7 +563,7 @@ spi_attach(device_t dev)
 	 * devices as its children, and those devices may need to do IO during
 	 * their attach. We can't do IO until timers and interrupts are working.
 	 */
-	sc->spibus = device_add_child(dev, "spibus", -1);
+	sc->spibus = device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
 	return (bus_delayed_attach_children(dev));
 }
 
diff --git a/sys/arm/freescale/vybrid/vf_ehci.c b/sys/arm/freescale/vybrid/vf_ehci.c
index f9ee6ed17fc2..a3477c743997 100644
--- a/sys/arm/freescale/vybrid/vf_ehci.c
+++ b/sys/arm/freescale/vybrid/vf_ehci.c
@@ -331,7 +331,7 @@ vybrid_ehci_attach(device_t dev)
 	}
 
 	/* Add USB device */
-	sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
+	sc->sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
 	if (!sc->sc_bus.bdev) {
 		device_printf(dev, "Could not add USB device\n");
 		err = bus_teardown_intr(dev, esc->res[5],
diff --git a/sys/arm/mv/a37x0_iic.c b/sys/arm/mv/a37x0_iic.c
index 5b92175383f0..01fda1579bd6 100644
--- a/sys/arm/mv/a37x0_iic.c
+++ b/sys/arm/mv/a37x0_iic.c
@@ -230,7 +230,7 @@ a37x0_iic_attach(device_t dev)
 	a37x0_iic_reset(sc);
 	A37X0_IIC_UNLOCK(sc);
 
-	sc->sc_iicbus = device_add_child(dev, "iicbus", -1);
+	sc->sc_iicbus = device_add_child(dev, "iicbus", DEVICE_UNIT_ANY);
 	if (sc->sc_iicbus == NULL) {
 		a37x0_iic_detach(dev);
 		return (ENXIO);
diff --git a/sys/arm/mv/a37x0_spi.c b/sys/arm/mv/a37x0_spi.c
index 4834eb095a17..4bcbbc503218 100644
--- a/sys/arm/mv/a37x0_spi.c
+++ b/sys/arm/mv/a37x0_spi.c
@@ -214,7 +214,7 @@ a37x0_spi_attach(device_t dev)
 		maxfreq = 0;
 	sc->sc_maxfreq = maxfreq;
 
-	device_add_child(dev, "spibus", -1);
+	device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
 
 	/* Probe and attach the spibus when interrupts are available. */
 	return (bus_delayed_attach_children(dev));
diff --git a/sys/arm/mv/mv_pci.c b/sys/arm/mv/mv_pci.c
index 87c6fbae3ca4..69c72c074c67 100644
--- a/sys/arm/mv/mv_pci.c
+++ b/sys/arm/mv/mv_pci.c
@@ -553,12 +553,12 @@ mv_pcib_attach(device_t self)
 		if (err)
 			goto error;
 
-		device_add_child(self, "pci", -1);
+		device_add_child(self, "pci", DEVICE_UNIT_ANY);
 	} else {
 		sc->sc_devnr = 1;
 		bus_space_write_4(sc->sc_bst, sc->sc_bsh,
 		    PCIE_REG_STATUS, 1 << PCIE_STATUS_DEV_OFFS);
-		device_add_child(self, "pci_ep", -1);
+		device_add_child(self, "pci_ep", DEVICE_UNIT_ANY);
 	}
 
 	mtx_init(&sc->sc_msi_mtx, "msi_mtx", NULL, MTX_DEF);
diff --git a/sys/arm/mv/mv_pci_ctrl.c b/sys/arm/mv/mv_pci_ctrl.c
index 0cff28e4ca76..e32d38281e9d 100644
--- a/sys/arm/mv/mv_pci_ctrl.c
+++ b/sys/arm/mv/mv_pci_ctrl.c
@@ -185,7 +185,7 @@ mv_pcib_ofw_bus_attach(device_t dev)
 				continue;
 			}
 
-			child = device_add_child(dev, NULL, -1);
+			child = device_add_child(dev, NULL, DEVICE_UNIT_ANY);
 			if (child == NULL) {
 				if (bootverbose) {
 					device_printf(dev,
diff --git a/sys/arm/mv/mv_spi.c b/sys/arm/mv/mv_spi.c
index 4efaee68f75d..621594624b7b 100644
--- a/sys/arm/mv/mv_spi.c
+++ b/sys/arm/mv/mv_spi.c
@@ -168,7 +168,7 @@ mv_spi_attach(device_t dev)
 
 	mtx_init(&sc->sc_mtx, "mv_spi", NULL, MTX_DEF);
 
-	device_add_child(dev, "spibus", -1);
+	device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
 
 	/* Probe and attach the spibus when interrupts are available. */
 	return (bus_delayed_attach_children(dev));
diff --git a/sys/arm/nvidia/tegra_ehci.c b/sys/arm/nvidia/tegra_ehci.c
index e8126a88ba87..15f086a6c3c0 100644
--- a/sys/arm/nvidia/tegra_ehci.c
+++ b/sys/arm/nvidia/tegra_ehci.c
@@ -259,7 +259,7 @@ tegra_ehci_attach(device_t dev)
 	}
 
 	/* Add USB bus device. */
-	esc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
+	esc->sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
 	if (esc->sc_bus.bdev == NULL) {
 		device_printf(dev, "Could not add USB device\n");
 		goto out;
diff --git a/sys/arm/nvidia/tegra_i2c.c b/sys/arm/nvidia/tegra_i2c.c
index 1b959c5c5bbe..0fe1aa7ba48e 100644
--- a/sys/arm/nvidia/tegra_i2c.c
+++ b/sys/arm/nvidia/tegra_i2c.c
@@ -714,7 +714,7 @@ tegra_i2c_attach(device_t dev)
 	}
 
 	/* Attach the iicbus. */
-	sc->iicbus = device_add_child(dev, "iicbus", -1);
+	sc->iicbus = device_add_child(dev, "iicbus", DEVICE_UNIT_ANY);
 	if (sc->iicbus == NULL) {
 		device_printf(dev, "Could not allocate iicbus instance.\n");
 		rv = ENXIO;
diff --git a/sys/arm/nvidia/tegra_pcie.c b/sys/arm/nvidia/tegra_pcie.c
index cb0c1c7ec4d4..2a91a81d40a9 100644
--- a/sys/arm/nvidia/tegra_pcie.c
+++ b/sys/arm/nvidia/tegra_pcie.c
@@ -1565,7 +1565,7 @@ tegra_pcib_attach(device_t dev)
 	if (rv != 0)
 		 goto out;
 #endif
-	device_add_child(dev, "pci", -1);
+	device_add_child(dev, "pci", DEVICE_UNIT_ANY);
 
 	return (bus_generic_attach(dev));
 
diff --git a/sys/arm/nvidia/tegra_xhci.c b/sys/arm/nvidia/tegra_xhci.c
index f7d541fabee4..e3b4dd483189 100644
--- a/sys/arm/nvidia/tegra_xhci.c
+++ b/sys/arm/nvidia/tegra_xhci.c
@@ -1048,7 +1048,7 @@ tegra_xhci_attach(device_t dev)
 	strlcpy(xsc->sc_vendor, "Nvidia", sizeof(xsc->sc_vendor));
 
 	/* Add USB bus device. */
-	xsc->sc_bus.bdev = device_add_child(sc->dev, "usbus", -1);
+	xsc->sc_bus.bdev = device_add_child(sc->dev, "usbus", DEVICE_UNIT_ANY);
 	if (xsc->sc_bus.bdev == NULL) {
 		device_printf(sc->dev, "Could not add USB device\n");
 		rv = ENXIO;
diff --git a/sys/arm/ti/am335x/am335x_musb.c b/sys/arm/ti/am335x/am335x_musb.c
index 93cb7cef41b9..147602c4dbd3 100644
--- a/sys/arm/ti/am335x/am335x_musb.c
+++ b/sys/arm/ti/am335x/am335x_musb.c
@@ -327,7 +327,7 @@ musbotg_attach(device_t dev)
 	sc->sc_otg.sc_io_size =
 	    rman_get_size(sc->sc_otg.sc_io_res);
 
-	sc->sc_otg.sc_bus.bdev = device_add_child(dev, "usbus", -1);
+	sc->sc_otg.sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
 	if (!(sc->sc_otg.sc_bus.bdev)) {
 		device_printf(dev, "No busdev for musb\n");
 		goto error;
diff --git a/sys/arm/ti/am335x/am335x_scm.c b/sys/arm/ti/am335x/am335x_scm.c
index 214a9dfdf18b..8245f35617ad 100644
--- a/sys/arm/ti/am335x/am335x_scm.c
+++ b/sys/arm/ti/am335x/am335x_scm.c
@@ -89,7 +89,7 @@ am335x_scm_identify(driver_t *driver, device_t parent)
 	if (device_find_child(parent, "am335x_scm", -1) != NULL)
 		return;
 
-	child = device_add_child(parent, "am335x_scm", -1);
+	child = device_add_child(parent, "am335x_scm", DEVICE_UNIT_ANY);
 	if (child == NULL)
 		device_printf(parent, "cannot add ti_scm child\n");
 }
diff --git a/sys/arm/ti/ti_spi.c b/sys/arm/ti/ti_spi.c
index b5616d36830c..9fabed46917d 100644
--- a/sys/arm/ti/ti_spi.c
+++ b/sys/arm/ti/ti_spi.c
@@ -263,7 +263,7 @@ ti_spi_attach(device_t dev)
 	ti_spi_printr(dev);
 #endif
 
-	device_add_child(dev, "spibus", -1);
+	device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
 
 	return (bus_generic_attach(dev));
 }
diff --git a/sys/arm/ti/usb/omap_ehci.c b/sys/arm/ti/usb/omap_ehci.c
index 9376be35c261..fee5f662963b 100644
--- a/sys/arm/ti/usb/omap_ehci.c
+++ b/sys/arm/ti/usb/omap_ehci.c
@@ -337,7 +337,7 @@ omap_ehci_attach(device_t dev)
 	}
 
 	/* Add this device as a child of the USBus device */
-	sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
+	sc->sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
 	if (!sc->sc_bus.bdev) {
 		device_printf(dev, "Error: could not add USB device\n");
 		goto error;
diff --git a/sys/arm/xilinx/zy7_ehci.c b/sys/arm/xilinx/zy7_ehci.c
index 57fe4115a86f..f2e1d8a9ec2b 100644
--- a/sys/arm/xilinx/zy7_ehci.c
+++ b/sys/arm/xilinx/zy7_ehci.c
@@ -258,7 +258,7 @@ zy7_ehci_attach(device_t dev)
 	}
 
 	/* Add USB device */
-	sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
+	sc->sc_bus.bdev = device_add_child(dev, "usbus", DEVICE_UNIT_ANY);
 	if (!sc->sc_bus.bdev) {
 		device_printf(dev, "Could not add USB device\n");
 		zy7_ehci_detach(dev);
diff --git a/sys/arm/xilinx/zy7_qspi.c b/sys/arm/xilinx/zy7_qspi.c
index d639c0bb02cf..81ceb79e2bf6 100644
--- a/sys/arm/xilinx/zy7_qspi.c
+++ b/sys/arm/xilinx/zy7_qspi.c
@@ -598,7 +598,7 @@ zy7_qspi_attach(device_t dev)
 		return (err);
 	}
 
-	sc->child = device_add_child(dev, "spibus", -1);
+	sc->child = device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
 
 	zy7_qspi_add_sysctls(dev);
 
diff --git a/sys/arm/xilinx/zy7_spi.c b/sys/arm/xilinx/zy7_spi.c
index c2cbf266ad05..bb21ca6eec43 100644
--- a/sys/arm/xilinx/zy7_spi.c
+++ b/sys/arm/xilinx/zy7_spi.c
@@ -434,7 +434,7 @@ zy7_spi_attach(device_t dev)
 		return (err);
 	}
 
-	sc->child = device_add_child(dev, "spibus", -1);
+	sc->child = device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
 
 	zy7_spi_add_sysctls(dev);
 
diff --git a/sys/arm64/arm64/gic_v3_acpi.c b/sys/arm64/arm64/gic_v3_acpi.c
index f91a8f6078d9..180066b88930 100644
--- a/sys/arm64/arm64/gic_v3_acpi.c
+++ b/sys/arm64/arm64/gic_v3_acpi.c
@@ -406,7 +406,7 @@ gic_v3_add_children(ACPI_SUBTABLE_HEADER *entry, void *arg)
 			return;
 		}
 
-		child = device_add_child(dev, "its", -1);
+		child = device_add_child(dev, "its", DEVICE_UNIT_ANY);
 		if (child == NULL) {
 			free(di, M_GIC_V3);
 			return;
diff --git a/sys/arm64/arm64/gic_v3_fdt.c b/sys/arm64/arm64/gic_v3_fdt.c
index 3a3647fc89a5..5637f6933956 100644
--- a/sys/arm64/arm64/gic_v3_fdt.c
+++ b/sys/arm64/arm64/gic_v3_fdt.c
@@ -339,7 +339,7 @@ gic_v3_ofw_bus_attach(device_t dev)
 			/* Should not have any interrupts, so don't add any */
 
 			/* Add newbus device for this FDT node */
-			child = device_add_child(dev, NULL, -1);
+			child = device_add_child(dev, NULL, DEVICE_UNIT_ANY);
 			if (!child) {
 				if (bootverbose) {
 					device_printf(dev,
diff --git a/sys/arm64/broadcom/brcmmdio/mdio_mux_iproc.c b/sys/arm64/broadcom/brcmmdio/mdio_mux_iproc.c
index 9e73985ded0d..6e6b3ad97310 100644
--- a/sys/arm64/broadcom/brcmmdio/mdio_mux_iproc.c
+++ b/sys/arm64/broadcom/brcmmdio/mdio_mux_iproc.c
@@ -342,7 +342,7 @@ brcm_iproc_mdio_attach(device_t dev)
 		ofw_bus_intr_to_rl(dev, node, &di->di_rl, NULL);
 
 		/* Add newbus device for this FDT node */
-		child = device_add_child(dev, NULL, -1);
+		child = device_add_child(dev, NULL, DEVICE_UNIT_ANY);
 		if (child == NULL) {
 			printf("Failed to add child\n");
 			resource_list_free(&di->di_rl);
diff --git a/sys/arm64/broadcom/brcmmdio/mdio_nexus_iproc.c b/sys/arm64/broadcom/brcmmdio/mdio_nexus_iproc.c
index f1bf5ac38bf9..852bd8815e7f 100644
--- a/sys/arm64/broadcom/brcmmdio/mdio_nexus_iproc.c
+++ b/sys/arm64/broadcom/brcmmdio/mdio_nexus_iproc.c
@@ -215,7 +215,7 @@ brcm_mdionexus_ofw_bus_attach(device_t dev)
 		ofw_bus_intr_to_rl(dev, node, &di->di_rl, NULL);
 
 		/* Add newbus device for this FDT node */
-		child = device_add_child(dev, NULL, -1);
+		child = device_add_child(dev, NULL, DEVICE_UNIT_ANY);
 		if (child == NULL) {
 			resource_list_free(&di->di_rl);
 			ofw_bus_gen_destroy_devinfo(&di->di_dinfo);
diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c
index 89393d9701d0..6b57aeee0732 100644
--- a/sys/arm64/cavium/thunder_pcie_pem.c
+++ b/sys/arm64/cavium/thunder_pcie_pem.c
@@ -906,7 +906,7 @@ thunder_pem_attach(device_t dev)
 		goto fail_io;
 	}
 
-	device_add_child(dev, "pci", -1);
+	device_add_child(dev, "pci", DEVICE_UNIT_ANY);
 
 	return (bus_generic_attach(dev));
 
diff --git a/sys/arm64/rockchip/rk_pcie.c b/sys/arm64/rockchip/rk_pcie.c
index 69ae4254a235..54619ca5b1d8 100644
--- a/sys/arm64/rockchip/rk_pcie.c
+++ b/sys/arm64/rockchip/rk_pcie.c
@@ -1353,7 +1353,7 @@ rk_pcie_attach(device_t dev)
 	APB_WR4(sc, PCIE_RC_CONFIG_LCS, val);
 
 	DELAY(250000);
-	device_add_child(dev, "pci", -1);
+	device_add_child(dev, "pci", DEVICE_UNIT_ANY);
 	return (bus_generic_attach(dev));
 
 out_full:
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c
index 34dbb56a66f7..db434841f778 100644
--- a/sys/dev/aac/aac.c
+++ b/sys/dev/aac/aac.c
@@ -3785,7 +3785,7 @@ aac_get_bus_info(struct aac_softc *sc)
 			break;
 		}
 
-		child = device_add_child(sc->aac_dev, "aacp", -1);
+		child = device_add_child(sc->aac_dev, "aacp", DEVICE_UNIT_ANY);
 		if (child == NULL) {
 			device_printf(sc->aac_dev,
 			    "device_add_child failed for passthrough bus %d\n",
diff --git a/sys/dev/aacraid/aacraid.c b/sys/dev/aacraid/aacraid.c
index 031a13ef021b..3bebba01c1b1 100644
--- a/sys/dev/aacraid/aacraid.c
+++ b/sys/dev/aacraid/aacraid.c
@@ -3608,7 +3608,7 @@ aac_container_bus(struct aac_softc *sc)
 	    	"No memory to add container bus\n");
 		panic("Out of memory?!");
 	}
-	child = device_add_child(sc->aac_dev, "aacraidp", -1);
+	child = device_add_child(sc->aac_dev, "aacraidp", DEVICE_UNIT_ANY);
 	if (child == NULL) {
 		device_printf(sc->aac_dev,
 	    	"device_add_child failed for container bus\n");
@@ -3725,7 +3725,7 @@ aac_get_bus_info(struct aac_softc *sc)
 			break;
 		}
 
-		child = device_add_child(sc->aac_dev, "aacraidp", -1);
+		child = device_add_child(sc->aac_dev, "aacraidp", DEVICE_UNIT_ANY);
 		if (child == NULL) {
 			device_printf(sc->aac_dev,
 			    "device_add_child failed for passthrough bus %d\n",
diff --git a/sys/dev/acpica/acpi_video.c b/sys/dev/acpica/acpi_video.c
index da7c2a4d19cb..472a38d3eb56 100644
--- a/sys/dev/acpica/acpi_video.c
+++ b/sys/dev/acpica/acpi_video.c
@@ -275,7 +275,7 @@ acpi_video_identify(driver_t *driver, device_t parent)
 {
 
 	if (device_find_child(parent, "acpi_video", -1) == NULL)
-		device_add_child(parent, "acpi_video", -1);
+		device_add_child(parent, "acpi_video", DEVICE_UNIT_ANY);
 }
 
 static int
diff --git a/sys/dev/adb/adb_bus.c b/sys/dev/adb/adb_bus.c
index 395ed555fec5..8c805254a2e6 100644
--- a/sys/dev/adb/adb_bus.c
+++ b/sys/dev/adb/adb_bus.c
@@ -178,7 +178,7 @@ adb_bus_enumerate(void *xdev)
 
 	for (i = 0; i < 16; i++) {
 		if (sc->devinfo[i].default_address) {
-			sc->children[i] = device_add_child(dev, NULL, -1);
+			sc->children[i] = device_add_child(dev, NULL, DEVICE_UNIT_ANY);
 			device_set_ivars(sc->children[i], &sc->devinfo[i]);
 		}
 	}
diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c
index df977889a9c0..b710a542a10f 100644
--- a/sys/dev/agp/agp_i810.c
+++ b/sys/dev/agp/agp_i810.c
@@ -682,7 +682,7 @@ agp_i810_identify(driver_t *driver, device_t parent)
 
 	if (device_find_child(parent, "agp", -1) == NULL &&
 	    agp_i810_match(parent))
-		device_add_child(parent, "agp", -1);
+		device_add_child(parent, "agp", DEVICE_UNIT_ANY);
 }
 
 static int
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c
index 2910247d9327..76d27dbe4953 100644
--- a/sys/dev/ahci/ahci.c
+++ b/sys/dev/ahci/ahci.c
@@ -354,7 +354,7 @@ ahci_attach(device_t dev)
 	}
 	/* Attach all channels on this controller */
 	for (unit = 0; unit < ctlr->channels; unit++) {
-		child = device_add_child(dev, "ahcich", -1);
+		child = device_add_child(dev, "ahcich", DEVICE_UNIT_ANY);
 		if (child == NULL) {
 			device_printf(dev, "failed to add channel device\n");
 			continue;
@@ -365,7 +365,7 @@ ahci_attach(device_t dev)
 	}
 	/* Attach any remapped NVME device */
 	for (; unit < ctlr->channels + ctlr->remapped_devices; unit++) {
-		child = device_add_child(dev, "nvme", -1);
+		child = device_add_child(dev, "nvme", DEVICE_UNIT_ANY);
 		if (child == NULL) {
 			device_printf(dev, "failed to add remapped NVMe device");
 			    continue;
@@ -377,7 +377,7 @@ ahci_attach(device_t dev)
 	resource_int_value(device_get_name(dev), device_get_unit(dev),
 	    "em", &em);
 	if (em) {
-		child = device_add_child(dev, "ahciem", -1);
+		child = device_add_child(dev, "ahciem", DEVICE_UNIT_ANY);
 		if (child == NULL)
 			device_printf(dev, "failed to add enclosure device\n");
 		else
diff --git a/sys/dev/alpm/alpm.c b/sys/dev/alpm/alpm.c
index 6bd84c96d282..814cfcd86802 100644
--- a/sys/dev/alpm/alpm.c
+++ b/sys/dev/alpm/alpm.c
@@ -218,7 +218,7 @@ alpm_attach(device_t dev)
 	mtx_init(&alpm->lock, device_get_nameunit(dev), "alpm", MTX_DEF);
 
 	/* attach the smbus */
-	alpm->smbus = device_add_child(dev, "smbus", -1);
+	alpm->smbus = device_add_child(dev, "smbus", DEVICE_UNIT_ANY);
 	if (alpm->smbus == NULL) {
 		alpm_detach(dev);
 		return (EINVAL);
diff --git a/sys/dev/amdpm/amdpm.c b/sys/dev/amdpm/amdpm.c
index f479c0f5bcdd..4f8515f21e0d 100644
--- a/sys/dev/amdpm/amdpm.c
+++ b/sys/dev/amdpm/amdpm.c
@@ -214,7 +214,7 @@ amdpm_attach(device_t dev)
 	mtx_init(&amdpm_sc->lock, device_get_nameunit(dev), "amdpm", MTX_DEF);
 
 	/* Allocate a new smbus device */
-	amdpm_sc->smbus = device_add_child(dev, "smbus", -1);
+	amdpm_sc->smbus = device_add_child(dev, "smbus", DEVICE_UNIT_ANY);
 	if (!amdpm_sc->smbus) {
 		amdpm_detach(dev);
 		return (EINVAL);
diff --git a/sys/dev/amdsmb/amdsmb.c b/sys/dev/amdsmb/amdsmb.c
index 565e73cf1f64..57a9bccbf58b 100644
--- a/sys/dev/amdsmb/amdsmb.c
+++ b/sys/dev/amdsmb/amdsmb.c
@@ -159,7 +159,7 @@ amdsmb_attach(device_t dev)
 	mtx_init(&amdsmb_sc->lock, device_get_nameunit(dev), "amdsmb", MTX_DEF);
 
 	/* Allocate a new smbus device */
-	amdsmb_sc->smbus = device_add_child(dev, "smbus", -1);
+	amdsmb_sc->smbus = device_add_child(dev, "smbus", DEVICE_UNIT_ANY);
 	if (!amdsmb_sc->smbus) {
 		amdsmb_detach(dev);
 		return (EINVAL);
diff --git a/sys/dev/amdsmn/amdsmn.c b/sys/dev/amdsmn/amdsmn.c
index d657ab84924a..cb2ddbd86c2e 100644
--- a/sys/dev/amdsmn/amdsmn.c
+++ b/sys/dev/amdsmn/amdsmn.c
@@ -176,7 +176,7 @@ amdsmn_identify(driver_t *driver, device_t parent)
 	if (!amdsmn_match(parent, NULL))
 		return;
 
-	child = device_add_child(parent, "amdsmn", -1);
+	child = device_add_child(parent, "amdsmn", DEVICE_UNIT_ANY);
 	if (child == NULL)
 		device_printf(parent, "add amdsmn child failed\n");
 }
diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c
index 56772432773e..9ff7388fd70c 100644
--- a/sys/dev/amdtemp/amdtemp.c
+++ b/sys/dev/amdtemp/amdtemp.c
@@ -280,7 +280,7 @@ amdtemp_identify(driver_t *driver, device_t parent)
 		return;
 
 	if (amdtemp_match(parent, NULL)) {
-		child = device_add_child(parent, "amdtemp", -1);
+		child = device_add_child(parent, "amdtemp", DEVICE_UNIT_ANY);
 		if (child == NULL)
 			device_printf(parent, "add amdtemp child failed\n");
 	}
diff --git a/sys/dev/ata/chipsets/ata-jmicron.c b/sys/dev/ata/chipsets/ata-jmicron.c
index 0ae80d2a85a1..7965e642869e 100644
--- a/sys/dev/ata/chipsets/ata-jmicron.c
+++ b/sys/dev/ata/chipsets/ata-jmicron.c
@@ -110,7 +110,7 @@ ata_jmicron_chipinit(device_t dev)
 	pci_write_config(dev, 0x80, 0x01200000, 4);
 	/* Create AHCI subdevice if AHCI part present. */
 	if (ctlr->chip->cfg1) {
-	    	child = device_add_child(dev, NULL, -1);
+		child = device_add_child(dev, NULL, DEVICE_UNIT_ANY);
 		if (child != NULL) {
 		    device_set_ivars(child, (void *)(intptr_t)-1);
 		    bus_generic_attach(dev);
diff --git a/sys/dev/ata/chipsets/ata-marvell.c b/sys/dev/ata/chipsets/ata-marvell.c
index f1feacd3f085..1f5f12b951b5 100644
--- a/sys/dev/ata/chipsets/ata-marvell.c
+++ b/sys/dev/ata/chipsets/ata-marvell.c
@@ -125,7 +125,7 @@ ata_marvell_chipinit(device_t dev)
 		return ENXIO;
 	/* Create AHCI subdevice if AHCI part present. */
 	if (ctlr->chip->cfg1) {
-	    	child = device_add_child(dev, NULL, -1);
+		child = device_add_child(dev, NULL, DEVICE_UNIT_ANY);
 		if (child != NULL) {
 		    device_set_ivars(child, (void *)(intptr_t)-1);
 		    bus_generic_attach(dev);
diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c
index ff6a0992c6b9..f375eb112cce 100644
--- a/sys/dev/cardbus/cardbus.c
+++ b/sys/dev/cardbus/cardbus.c
@@ -198,7 +198,7 @@ cardbus_attach_card(device_t cbdev)
 		if (dinfo->pci.cfg.mfdev)
 			cardbusfunchigh = PCI_FUNCMAX;
 
-		child = device_add_child(cbdev, NULL, -1);
+		child = device_add_child(cbdev, NULL, DEVICE_UNIT_ANY);
 		if (child == NULL) {
 			DEVPRINTF((cbdev, "Cannot add child!\n"));
 			pci_freecfg((struct pci_devinfo *)dinfo);
diff --git a/sys/dev/cfi/cfi_core.c b/sys/dev/cfi/cfi_core.c
index 9554a710d8f2..79e09b45909b 100644
--- a/sys/dev/cfi/cfi_core.c
+++ b/sys/dev/cfi/cfi_core.c
@@ -445,7 +445,7 @@ cfi_attach(device_t dev)
 	}
 #endif
 
-	device_add_child(dev, "cfid", -1);
+	device_add_child(dev, "cfid", DEVICE_UNIT_ANY);
 	bus_generic_attach(dev);
 
 	return (0);
diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c
index 4ea4ad1639eb..568a948a49f7 100644
--- a/sys/dev/cxgbe/crypto/t4_crypto.c
+++ b/sys/dev/cxgbe/crypto/t4_crypto.c
@@ -1805,7 +1805,7 @@ ccr_identify(driver_t *driver, device_t parent)
 	sc = device_get_softc(parent);
 	if (sc->cryptocaps & FW_CAPS_CONFIG_CRYPTO_LOOKASIDE &&
 	    device_find_child(parent, "ccr", -1) == NULL)
-		device_add_child(parent, "ccr", -1);
+		device_add_child(parent, "ccr", DEVICE_UNIT_ANY);
 }
 
 static int
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 3baa2d5ac0f7..795c8d7e2e37 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -2725,7 +2725,7 @@ cxgbe_attach(device_t dev)
 	for_each_vi(pi, i, vi) {
 		if (i == 0)
 			continue;
-		vi->dev = device_add_child(dev, sc->names->vi_ifnet_name, -1);
+		vi->dev = device_add_child(dev, sc->names->vi_ifnet_name, DEVICE_UNIT_ANY);
 		if (vi->dev == NULL) {
 			device_printf(dev, "failed to add VI %d\n", i);
 			continue;
diff --git a/sys/dev/cxgbe/t4_vf.c b/sys/dev/cxgbe/t4_vf.c
index 8ca6dd98a66f..e941b87d7182 100644
--- a/sys/dev/cxgbe/t4_vf.c
+++ b/sys/dev/cxgbe/t4_vf.c
@@ -673,7 +673,7 @@ t4vf_attach(device_t dev)
 		ifmedia_init(&pi->media, IFM_IMASK, cxgbe_media_change,
 		    cxgbe_media_status);
 
-		pi->dev = device_add_child(dev, sc->names->vf_ifnet_name, -1);
+		pi->dev = device_add_child(dev, sc->names->vf_ifnet_name, DEVICE_UNIT_ANY);
 		if (pi->dev == NULL) {
 			device_printf(dev,
 			    "failed to add device for port %d.\n", i);
diff --git a/sys/dev/drm2/drm_dp_iic_helper.c b/sys/dev/drm2/drm_dp_iic_helper.c
index fd703494cd5e..06ee8c34f8bb 100644
--- a/sys/dev/drm2/drm_dp_iic_helper.c
+++ b/sys/dev/drm2/drm_dp_iic_helper.c
@@ -207,7 +207,7 @@ iic_dp_aux_attach(device_t idev)
 	struct iic_dp_aux_data *aux_data;
 
 	aux_data = device_get_softc(idev);
-	aux_data->port = device_add_child(idev, "iicbus", -1);
+	aux_data->port = device_add_child(idev, "iicbus", DEVICE_UNIT_ANY);
 	if (aux_data->port == NULL)
 		return (ENXIO);
 	device_quiet(aux_data->port);
diff --git a/sys/dev/etherswitch/miiproxy.c b/sys/dev/etherswitch/miiproxy.c
index 97d4b7f6eb67..24822b15f89e 100644
--- a/sys/dev/etherswitch/miiproxy.c
+++ b/sys/dev/etherswitch/miiproxy.c
@@ -380,7 +380,7 @@ mii_attach_proxy(device_t dev)
 		return (NULL);
 	}
 
-	miiproxy = device_add_child(dev, miiproxy_driver.name, -1);
+	miiproxy = device_add_child(dev, miiproxy_driver.name, DEVICE_UNIT_ANY);
 	error = bus_generic_attach(dev);
 	if (error != 0) {
 		device_printf(dev, "can't attach miiproxy\n");
diff --git a/sys/dev/exca/exca.c b/sys/dev/exca/exca.c
index 98e0ffdf9d18..44cb399cd49e 100644
--- a/sys/dev/exca/exca.c
+++ b/sys/dev/exca/exca.c
@@ -643,7 +643,7 @@ exca_init(struct exca_softc *sc, device_t dev,
 	sc->flags = 0;
 	sc->getb = exca_mem_getb;
 	sc->putb = exca_mem_putb;
-	sc->pccarddev = device_add_child(dev, "pccard", -1);
+	sc->pccarddev = device_add_child(dev, "pccard", DEVICE_UNIT_ANY);
 	if (sc->pccarddev == NULL)
 		DEVPRINTF(brdev, "WARNING: cannot add pccard bus.\n");
 	else if (device_probe_and_attach(sc->pccarddev) != 0)
diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c
index c8fee7d400c1..8c64ee9e862d 100644
--- a/sys/dev/gpio/gpiobus.c
+++ b/sys/dev/gpio/gpiobus.c
@@ -299,7 +299,7 @@ gpiobus_attach_bus(device_t dev)
 {
 	device_t busdev;
 
-	busdev = device_add_child(dev, "gpiobus", -1);
+	busdev = device_add_child(dev, "gpiobus", DEVICE_UNIT_ANY);
 	if (busdev == NULL)
 		return (NULL);
 	if (device_add_child(dev, "gpioc", -1) == NULL) {
diff --git a/sys/dev/gpio/gpioiic.c b/sys/dev/gpio/gpioiic.c
index 4f24dac23e51..68068c0e7ec1 100644
--- a/sys/dev/gpio/gpioiic.c
+++ b/sys/dev/gpio/gpioiic.c
@@ -320,7 +320,7 @@ gpioiic_attach(device_t dev)
 #endif
 
 	/* Add the bitbang driver as our only child; it will add iicbus. */
-	device_add_child(sc->dev, "iicbb", -1);
+	device_add_child(sc->dev, "iicbb", DEVICE_UNIT_ANY);
 	return (bus_generic_attach(dev));
 }
 
diff --git a/sys/dev/gpio/gpiospi.c b/sys/dev/gpio/gpiospi.c
index 15517f74f0b3..1f58e7c79ce3 100644
--- a/sys/dev/gpio/gpiospi.c
+++ b/sys/dev/gpio/gpiospi.c
@@ -177,7 +177,7 @@ gpio_spi_attach(device_t dev)
 
 	gpio_spi_chip_deactivate(sc, -1);
 
-	device_add_child(dev, "spibus", -1);
+	device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
 	return (bus_generic_attach(dev));
 }
 
diff --git a/sys/dev/gpio/ofw_gpiobus.c b/sys/dev/gpio/ofw_gpiobus.c
index 9173bcd1500c..8cadc12934e0 100644
--- a/sys/dev/gpio/ofw_gpiobus.c
+++ b/sys/dev/gpio/ofw_gpiobus.c
@@ -157,7 +157,7 @@ ofw_gpiobus_add_fdt_child(device_t bus, const char *drvname, phandle_t child)
 	/*
 	 * Set up the GPIO child and OFW bus layer devinfo and add it to bus.
 	 */
-	childdev = device_add_child(bus, drvname, -1);
+	childdev = device_add_child(bus, drvname, DEVICE_UNIT_ANY);
 	if (childdev == NULL)
 		return (NULL);
 	dinfo = ofw_gpiobus_setup_devinfo(bus, childdev, child);
diff --git a/sys/dev/hyperv/pcib/vmbus_pcib.c b/sys/dev/hyperv/pcib/vmbus_pcib.c
index 9aec2fac698a..7c596c724e52 100644
--- a/sys/dev/hyperv/pcib/vmbus_pcib.c
+++ b/sys/dev/hyperv/pcib/vmbus_pcib.c
@@ -1564,7 +1564,7 @@ vmbus_pcib_attach(device_t dev)
 
 	vmbus_pcib_prepopulate_bars(hbus);
 
-	hbus->pci_bus = device_add_child(dev, "pci", -1);
+	hbus->pci_bus = device_add_child(dev, "pci", DEVICE_UNIT_ANY);
 	if (!hbus->pci_bus) {
 		device_printf(dev, "failed to create pci bus\n");
 		ret = ENXIO;
diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c
index 4157a4c41cea..774ba6da46e7 100644
*** 2469 LINES SKIPPED ***