diff --git a/share/examples/drivers/make_device_driver.sh b/share/examples/drivers/make_device_driver.sh --- a/share/examples/drivers/make_device_driver.sh +++ b/share/examples/drivers/make_device_driver.sh @@ -342,7 +342,8 @@ if ((ioport == 0) && (irq == 0)) return; /* We've added all our local hints. */ - child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "${1}", -1); + child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "${1}", + DEVICE_UNIT_ANY); bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, NUMPORTS); bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1); bus_set_resource(child, SYS_RES_DRQ, 0, res[i].drq, 1); diff --git a/stand/kshim/bsd_kernel.c b/stand/kshim/bsd_kernel.c --- a/stand/kshim/bsd_kernel.c +++ b/stand/kshim/bsd_kernel.c @@ -1326,12 +1326,13 @@ { uint32_t x; - usb_pci_root = device_add_child(NULL, "pci", -1); + usb_pci_root = device_add_child(NULL, "pci", DEVICE_UNIT_ANY); if (usb_pci_root == NULL) return; for (x = 0; x != USB_PCI_USB_MAX; x++) { - usb_pci_dev[x] = device_add_child(usb_pci_root, usb_pci_devices[x], -1); + usb_pci_dev[x] = device_add_child(usb_pci_root, + usb_pci_devices[x], DEVICE_UNIT_ANY); if (usb_pci_dev[x] == NULL) continue; if (device_probe_and_attach(usb_pci_dev[x])) { diff --git a/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c b/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c --- a/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c @@ -1204,9 +1204,9 @@ return; DPRINTF("driver=%p, parent=%p\n", driver, parent); - if (device_find_child(parent, "bcm2835_cpufreq", -1) != NULL) + if (device_find_child(parent, "bcm2835_cpufreq", DEVICE_UNIT_ANY) != NULL) return; - if (BUS_ADD_CHILD(parent, 0, "bcm2835_cpufreq", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "bcm2835_cpufreq", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add child failed\n"); } diff --git a/sys/arm/nvidia/tegra124/tegra124_coretemp.c b/sys/arm/nvidia/tegra124/tegra124_coretemp.c --- a/sys/arm/nvidia/tegra124/tegra124_coretemp.c +++ b/sys/arm/nvidia/tegra124/tegra124_coretemp.c @@ -176,9 +176,9 @@ root = OF_finddevice("/"); if (!ofw_bus_node_is_compatible(root, "nvidia,tegra124")) return; - if (device_find_child(parent, "tegra124_coretemp", -1) != NULL) + if (device_find_child(parent, "tegra124_coretemp", DEVICE_UNIT_ANY) != NULL) return; - if (BUS_ADD_CHILD(parent, 0, "tegra124_coretemp", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "tegra124_coretemp", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add child failed\n"); } diff --git a/sys/arm/nvidia/tegra124/tegra124_cpufreq.c b/sys/arm/nvidia/tegra124/tegra124_cpufreq.c --- a/sys/arm/nvidia/tegra124/tegra124_cpufreq.c +++ b/sys/arm/nvidia/tegra124/tegra124_cpufreq.c @@ -475,9 +475,9 @@ if (device_get_unit(parent) != 0) return; - if (device_find_child(parent, "tegra124_cpufreq", -1) != NULL) + if (device_find_child(parent, "tegra124_cpufreq", DEVICE_UNIT_ANY) != NULL) return; - if (BUS_ADD_CHILD(parent, 0, "tegra124_cpufreq", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "tegra124_cpufreq", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add child failed\n"); } diff --git a/sys/arm/ti/am335x/am335x_ehrpwm.c b/sys/arm/ti/am335x/am335x_ehrpwm.c --- a/sys/arm/ti/am335x/am335x_ehrpwm.c +++ b/sys/arm/ti/am335x/am335x_ehrpwm.c @@ -512,7 +512,8 @@ reg |= TBCTL_CTRMODE_UP | TBCTL_FREERUN; EPWM_WRITE2(sc, EPWM_TBCTL, reg); - if ((sc->sc_busdev = device_add_child(dev, "pwmbus", -1)) == NULL) { + if ((sc->sc_busdev = device_add_child(dev, "pwmbus", + DEVICE_UNIT_ANY)) == NULL) { device_printf(dev, "Cannot add child pwmbus\n"); // This driver can still do things even without the bus child. } diff --git a/sys/arm/ti/am335x/am335x_scm.c b/sys/arm/ti/am335x/am335x_scm.c --- a/sys/arm/ti/am335x/am335x_scm.c +++ b/sys/arm/ti/am335x/am335x_scm.c @@ -86,7 +86,7 @@ return; /* Make sure we attach only once. */ - if (device_find_child(parent, "am335x_scm", -1) != NULL) + if (device_find_child(parent, "am335x_scm", DEVICE_UNIT_ANY) != NULL) return; child = device_add_child(parent, "am335x_scm", DEVICE_UNIT_ANY); diff --git a/sys/arm/ti/ti_i2c.c b/sys/arm/ti/ti_i2c.c --- a/sys/arm/ti/ti_i2c.c +++ b/sys/arm/ti/ti_i2c.c @@ -851,7 +851,8 @@ goto out; /* Attach the iicbus. */ - if ((sc->sc_iicbus = device_add_child(dev, "iicbus", -1)) == NULL) { + if ((sc->sc_iicbus = device_add_child(dev, "iicbus", + DEVICE_UNIT_ANY)) == NULL) { device_printf(dev, "could not allocate iicbus instance\n"); err = ENXIO; goto out; diff --git a/sys/arm64/arm64/gic_v3_acpi.c b/sys/arm64/arm64/gic_v3_acpi.c --- a/sys/arm64/arm64/gic_v3_acpi.c +++ b/sys/arm64/arm64/gic_v3_acpi.c @@ -450,7 +450,7 @@ gic_v3_add_children, dev); /* Add the vgic child if needed */ if (((uintptr_t)acpi_get_private(dev) & GICV3_PRIV_FLAGS) != 0) { - child = device_add_child(dev, "vgic", -1); + child = device_add_child(dev, "vgic", DEVICE_UNIT_ANY); if (child == NULL) { device_printf(dev, "Could not add vgic child\n"); } else { diff --git a/sys/arm64/arm64/gic_v3_fdt.c b/sys/arm64/arm64/gic_v3_fdt.c --- a/sys/arm64/arm64/gic_v3_fdt.c +++ b/sys/arm64/arm64/gic_v3_fdt.c @@ -363,7 +363,7 @@ * child so we can use this in the vmm module for bhyve. */ if (OF_hasprop(parent, "interrupts")) { - child = device_add_child(dev, "vgic", -1); + child = device_add_child(dev, "vgic", DEVICE_UNIT_ANY); if (child == NULL) { device_printf(dev, "Could not add vgic child\n"); } else { diff --git a/sys/arm64/cavium/thunder_pcie_fdt.c b/sys/arm64/cavium/thunder_pcie_fdt.c --- a/sys/arm64/cavium/thunder_pcie_fdt.c +++ b/sys/arm64/cavium/thunder_pcie_fdt.c @@ -152,7 +152,7 @@ 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/nvidia/tegra210/tegra210_coretemp.c b/sys/arm64/nvidia/tegra210/tegra210_coretemp.c --- a/sys/arm64/nvidia/tegra210/tegra210_coretemp.c +++ b/sys/arm64/nvidia/tegra210/tegra210_coretemp.c @@ -181,9 +181,9 @@ root = OF_finddevice("/"); if (!ofw_bus_node_is_compatible(root, "nvidia,tegra210")) return; - if (device_find_child(parent, "tegra210_coretemp", -1) != NULL) + if (device_find_child(parent, "tegra210_coretemp", DEVICE_UNIT_ANY) != NULL) return; - if (BUS_ADD_CHILD(parent, 0, "tegra210_coretemp", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "tegra210_coretemp", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add child failed\n"); } diff --git a/sys/arm64/nvidia/tegra210/tegra210_cpufreq.c b/sys/arm64/nvidia/tegra210/tegra210_cpufreq.c --- a/sys/arm64/nvidia/tegra210/tegra210_cpufreq.c +++ b/sys/arm64/nvidia/tegra210/tegra210_cpufreq.c @@ -393,9 +393,9 @@ if (device_get_unit(parent) != 0) return; - if (device_find_child(parent, "tegra210_cpufreq", -1) != NULL) + if (device_find_child(parent, "tegra210_cpufreq", DEVICE_UNIT_ANY) != NULL) return; - if (BUS_ADD_CHILD(parent, 0, "tegra210_cpufreq", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "tegra210_cpufreq", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add child failed\n"); } diff --git a/sys/compat/linuxkpi/common/src/linux_i2c.c b/sys/compat/linuxkpi/common/src/linux_i2c.c --- a/sys/compat/linuxkpi/common/src/linux_i2c.c +++ b/sys/compat/linuxkpi/common/src/linux_i2c.c @@ -85,7 +85,7 @@ struct lkpi_iic_softc *sc; sc = device_get_softc(dev); - 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, "Couldn't add iicbus child, aborting\n"); return (ENXIO); @@ -323,7 +323,8 @@ device_printf(adapter->dev.parent->bsddev, "Adding i2c adapter %s\n", adapter->name); sx_xlock(&lkpi_sx_i2c); - lkpi_iic = device_add_child(adapter->dev.parent->bsddev, "lkpi_iic", -1); + lkpi_iic = device_add_child(adapter->dev.parent->bsddev, "lkpi_iic", + DEVICE_UNIT_ANY); if (lkpi_iic == NULL) { device_printf(adapter->dev.parent->bsddev, "Couldn't add lkpi_iic\n"); sx_xunlock(&lkpi_sx_i2c); diff --git a/sys/compat/linuxkpi/common/src/linux_i2cbb.c b/sys/compat/linuxkpi/common/src/linux_i2cbb.c --- a/sys/compat/linuxkpi/common/src/linux_i2cbb.c +++ b/sys/compat/linuxkpi/common/src/linux_i2cbb.c @@ -90,7 +90,7 @@ struct lkpi_iicbb_softc *sc; sc = device_get_softc(dev); - sc->iicbb = device_add_child(dev, "iicbb", -1); + sc->iicbb = device_add_child(dev, "iicbb", DEVICE_UNIT_ANY); if (sc->iicbb == NULL) { device_printf(dev, "Couldn't add iicbb child, aborting\n"); return (ENXIO); @@ -308,7 +308,8 @@ device_printf(adapter->dev.parent->bsddev, "Adding i2c adapter %s\n", adapter->name); sx_xlock(&lkpi_sx_i2cbb); - lkpi_iicbb = device_add_child(adapter->dev.parent->bsddev, "lkpi_iicbb", -1); + lkpi_iicbb = device_add_child(adapter->dev.parent->bsddev, "lkpi_iicbb", + DEVICE_UNIT_ANY); if (lkpi_iicbb == NULL) { device_printf(adapter->dev.parent->bsddev, "Couldn't add lkpi_iicbb\n"); sx_xunlock(&lkpi_sx_i2cbb); diff --git a/sys/crypto/aesni/aesni.c b/sys/crypto/aesni/aesni.c --- a/sys/crypto/aesni/aesni.c +++ b/sys/crypto/aesni/aesni.c @@ -81,8 +81,8 @@ { /* NB: order 10 is so we get attached after h/w devices */ - if (device_find_child(parent, "aesni", -1) == NULL && - BUS_ADD_CHILD(parent, 10, "aesni", -1) == 0) + if (device_find_child(parent, "aesni", DEVICE_UNIT_ANY) == NULL && + BUS_ADD_CHILD(parent, 10, "aesni", DEVICE_UNIT_ANY) == 0) panic("aesni: could not attach"); } diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -73,8 +73,8 @@ { /* NB: order 10 is so we get attached after h/w devices */ - if (device_find_child(parent, "armv8crypto", -1) == NULL && - BUS_ADD_CHILD(parent, 10, "armv8crypto", -1) == 0) + if (device_find_child(parent, "armv8crypto", DEVICE_UNIT_ANY) == NULL && + BUS_ADD_CHILD(parent, 10, "armv8crypto", DEVICE_UNIT_ANY) == 0) panic("ARMv8 crypto: could not attach"); } diff --git a/sys/crypto/blake2/blake2_cryptodev.c b/sys/crypto/blake2/blake2_cryptodev.c --- a/sys/crypto/blake2/blake2_cryptodev.c +++ b/sys/crypto/blake2/blake2_cryptodev.c @@ -61,8 +61,8 @@ { /* NB: order 10 is so we get attached after h/w devices */ - if (device_find_child(parent, "blaketwo", -1) == NULL && - BUS_ADD_CHILD(parent, 10, "blaketwo", -1) == 0) + if (device_find_child(parent, "blaketwo", DEVICE_UNIT_ANY) == NULL && + BUS_ADD_CHILD(parent, 10, "blaketwo", DEVICE_UNIT_ANY) == 0) panic("blaketwo: could not attach"); } diff --git a/sys/crypto/openssl/ossl.c b/sys/crypto/openssl/ossl.c --- a/sys/crypto/openssl/ossl.c +++ b/sys/crypto/openssl/ossl.c @@ -56,7 +56,7 @@ ossl_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "ossl", -1) == NULL) + if (device_find_child(parent, "ossl", DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 10, "ossl", DEVICE_UNIT_ANY); } diff --git a/sys/crypto/via/padlock.c b/sys/crypto/via/padlock.c --- a/sys/crypto/via/padlock.c +++ b/sys/crypto/via/padlock.c @@ -71,8 +71,8 @@ padlock_identify(driver_t *drv, device_t parent) { /* NB: order 10 is so we get attached after h/w devices */ - if (device_find_child(parent, "padlock", -1) == NULL && - BUS_ADD_CHILD(parent, 10, "padlock", -1) == 0) + if (device_find_child(parent, "padlock", DEVICE_UNIT_ANY) == NULL && + BUS_ADD_CHILD(parent, 10, "padlock", DEVICE_UNIT_ANY) == 0) panic("padlock: could not attach"); } diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -473,7 +473,7 @@ mir->MntTable[0].FileSystemName, mir->MntTable[0].Capacity, mir->MntTable[0].VolType); - if ((child = device_add_child(sc->aac_dev, "aacd", -1)) == NULL) + if ((child = device_add_child(sc->aac_dev, "aacd", DEVICE_UNIT_ANY)) == NULL) device_printf(sc->aac_dev, "device_add_child failed\n"); else device_set_ivars(child, co); diff --git a/sys/dev/acpi_support/acpi_asus_wmi.c b/sys/dev/acpi_support/acpi_asus_wmi.c --- a/sys/dev/acpi_support/acpi_asus_wmi.c +++ b/sys/dev/acpi_support/acpi_asus_wmi.c @@ -454,7 +454,7 @@ return; /* Add only a single device instance. */ - if (device_find_child(parent, "acpi_asus_wmi", -1) != NULL) + if (device_find_child(parent, "acpi_asus_wmi", DEVICE_UNIT_ANY) != NULL) return; /* Check management GUID to see whether system is compatible. */ @@ -462,7 +462,7 @@ ACPI_ASUS_WMI_MGMT_GUID)) return; - if (BUS_ADD_CHILD(parent, 0, "acpi_asus_wmi", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "acpi_asus_wmi", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add acpi_asus_wmi child failed\n"); } diff --git a/sys/dev/acpi_support/acpi_hp.c b/sys/dev/acpi_support/acpi_hp.c --- a/sys/dev/acpi_support/acpi_hp.c +++ b/sys/dev/acpi_support/acpi_hp.c @@ -465,7 +465,7 @@ return; /* Add only a single device instance. */ - if (device_find_child(parent, "acpi_hp", -1) != NULL) + if (device_find_child(parent, "acpi_hp", DEVICE_UNIT_ANY) != NULL) return; /* Check BIOS GUID to see whether system is compatible. */ @@ -473,7 +473,7 @@ ACPI_HP_WMI_BIOS_GUID)) return; - if (BUS_ADD_CHILD(parent, 0, "acpi_hp", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "acpi_hp", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add acpi_hp child failed\n"); } diff --git a/sys/dev/acpi_support/acpi_sbl_wmi.c b/sys/dev/acpi_support/acpi_sbl_wmi.c --- a/sys/dev/acpi_support/acpi_sbl_wmi.c +++ b/sys/dev/acpi_support/acpi_sbl_wmi.c @@ -59,7 +59,7 @@ return; /* Add only a single device instance. */ - if (device_find_child(parent, "acpi_sbl_wmi", -1) != NULL) + if (device_find_child(parent, "acpi_sbl_wmi", DEVICE_UNIT_ANY) != NULL) return; /* Check management GUID to see whether system is compatible. */ @@ -67,7 +67,7 @@ ACPI_SBL_FW_UPDATE_WMI_GUID)) return; - if (BUS_ADD_CHILD(parent, 0, "acpi_sbl_wmi", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "acpi_sbl_wmi", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add acpi_sbl_wmi child failed\n"); } diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c --- a/sys/dev/acpica/acpi_pcib_acpi.c +++ b/sys/dev/acpica/acpi_pcib_acpi.c @@ -473,7 +473,7 @@ error = 0; bus_identify_children(dev); - if (device_add_child(dev, "pci", -1) == NULL) { + if (device_add_child(dev, "pci", DEVICE_UNIT_ANY) == NULL) { bus_dma_tag_destroy(sc->ap_dma_tag); sc->ap_dma_tag = NULL; error = ENXIO; diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c --- a/sys/dev/acpica/acpi_perf.c +++ b/sys/dev/acpica/acpi_perf.c @@ -142,7 +142,7 @@ device_t dev; /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "acpi_perf", -1) != NULL) + if (device_find_child(parent, "acpi_perf", DEVICE_UNIT_ANY) != NULL) return; /* Get the handle for the Processor object and check for perf states. */ diff --git a/sys/dev/acpica/acpi_throttle.c b/sys/dev/acpica/acpi_throttle.c --- a/sys/dev/acpica/acpi_throttle.c +++ b/sys/dev/acpica/acpi_throttle.c @@ -131,7 +131,7 @@ ACPI_OBJECT *obj; /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "acpi_throttle", -1)) + if (device_find_child(parent, "acpi_throttle", DEVICE_UNIT_ANY)) return; /* Check for a valid duty width and parent CPU type. */ @@ -173,8 +173,8 @@ * Since p4tcc uses the same mechanism (but internal to the CPU), * we disable acpi_throttle when p4tcc is also present. */ - if (device_find_child(device_get_parent(dev), "p4tcc", -1) && - !resource_disabled("p4tcc", 0)) + if (device_find_child(device_get_parent(dev), "p4tcc", DEVICE_UNIT_ANY) + && !resource_disabled("p4tcc", 0)) return (ENXIO); device_set_desc(dev, "ACPI CPU Throttling"); diff --git a/sys/dev/acpica/acpi_video.c b/sys/dev/acpica/acpi_video.c --- a/sys/dev/acpica/acpi_video.c +++ b/sys/dev/acpica/acpi_video.c @@ -274,7 +274,7 @@ acpi_video_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "acpi_video", -1) == NULL) + if (device_find_child(parent, "acpi_video", DEVICE_UNIT_ANY) == NULL) device_add_child(parent, "acpi_video", DEVICE_UNIT_ANY); } diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c --- a/sys/dev/agp/agp_i810.c +++ b/sys/dev/agp/agp_i810.c @@ -680,7 +680,7 @@ agp_i810_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "agp", -1) == NULL && + if (device_find_child(parent, "agp", DEVICE_UNIT_ANY) == NULL && agp_i810_match(parent)) device_add_child(parent, "agp", DEVICE_UNIT_ANY); } diff --git a/sys/dev/amdsbwd/amdsbwd.c b/sys/dev/amdsbwd/amdsbwd.c --- a/sys/dev/amdsbwd/amdsbwd.c +++ b/sys/dev/amdsbwd/amdsbwd.c @@ -255,7 +255,7 @@ if (resource_disabled("amdsbwd", 0)) return; - if (device_find_child(parent, "amdsbwd", -1) != NULL) + if (device_find_child(parent, "amdsbwd", DEVICE_UNIT_ANY) != NULL) return; /* @@ -271,7 +271,8 @@ pci_get_devid(smb_dev) != HYGONCZ_SMBUS_DEVID) return; - child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "amdsbwd", DEVICE_UNIT_ANY); + child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "amdsbwd", + DEVICE_UNIT_ANY); if (child == NULL) device_printf(parent, "add amdsbwd child failed\n"); } diff --git a/sys/dev/amdsmn/amdsmn.c b/sys/dev/amdsmn/amdsmn.c --- a/sys/dev/amdsmn/amdsmn.c +++ b/sys/dev/amdsmn/amdsmn.c @@ -207,7 +207,7 @@ device_t child; /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "amdsmn", -1) != NULL) + if (device_find_child(parent, "amdsmn", DEVICE_UNIT_ANY) != NULL) return; if (!amdsmn_match(parent, NULL)) return; diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c --- a/sys/dev/amdtemp/amdtemp.c +++ b/sys/dev/amdtemp/amdtemp.c @@ -287,7 +287,7 @@ device_t child; /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "amdtemp", -1) != NULL) + if (device_find_child(parent, "amdtemp", DEVICE_UNIT_ANY) != NULL) return; if (amdtemp_match(parent, NULL)) { diff --git a/sys/dev/atopcase/atopcase.c b/sys/dev/atopcase/atopcase.c --- a/sys/dev/atopcase/atopcase.c +++ b/sys/dev/atopcase/atopcase.c @@ -476,7 +476,7 @@ goto exit; } - hidbus = device_add_child(sc->sc_dev, "hidbus", -1); + hidbus = device_add_child(sc->sc_dev, "hidbus", DEVICE_UNIT_ANY); if (hidbus == NULL) { device_printf(sc->sc_dev, "can't add child\n"); err = ENOMEM; diff --git a/sys/dev/bhnd/bhnd_subr.c b/sys/dev/bhnd/bhnd_subr.c --- a/sys/dev/bhnd/bhnd_subr.c +++ b/sys/dev/bhnd/bhnd_subr.c @@ -2170,7 +2170,7 @@ bus_topo_assert(); /* Look for a directly-attached NVRAM child */ - if ((nvram = device_find_child(dev, "bhnd_nvram", -1)) != NULL) + if ((nvram = device_find_child(dev, "bhnd_nvram", DEVICE_UNIT_ANY)) != NULL) return BHND_NVRAM_GETVAR(nvram, name, buf, size, type); /* Try to delegate to parent */ diff --git a/sys/dev/bhnd/cores/chipc/chipc_spi.c b/sys/dev/bhnd/cores/chipc/chipc_spi.c --- a/sys/dev/bhnd/cores/chipc/chipc_spi.c +++ b/sys/dev/bhnd/cores/chipc/chipc_spi.c @@ -107,7 +107,8 @@ * XXX: This should be replaced with a DEVICE_IDENTIFY implementation * in chipc-specific subclasses of the mx25l and at45d drivers. */ - if ((spibus = device_add_child(dev, "spibus", -1)) == NULL) { + if ((spibus = device_add_child(dev, "spibus", + DEVICE_UNIT_ANY)) == NULL) { device_printf(dev, "failed to add spibus\n"); error = ENXIO; goto failed; @@ -121,7 +122,8 @@ ccaps = BHND_CHIPC_GET_CAPS(device_get_parent(dev)); flash_name = chipc_sflash_device_name(ccaps->flash_type); if (flash_name != NULL) { - flash_dev = BUS_ADD_CHILD(spibus, 0, flash_name, DEVICE_UNIT_ANY); + flash_dev = BUS_ADD_CHILD(spibus, 0, flash_name, + DEVICE_UNIT_ANY); if (flash_dev == NULL) { device_printf(dev, "failed to add %s\n", flash_name); error = ENXIO; diff --git a/sys/dev/bwn/if_bwn_pci.c b/sys/dev/bwn/if_bwn_pci.c --- a/sys/dev/bwn/if_bwn_pci.c +++ b/sys/dev/bwn/if_bwn_pci.c @@ -182,7 +182,7 @@ sc->quirks = ident->quirks; /* Attach bridge device */ - if ((error = bhndb_attach_bridge(dev, &sc->bhndb_dev, -1))) + if ((error = bhndb_attach_bridge(dev, &sc->bhndb_dev, DEVICE_UNIT_ANY))) return (ENXIO); /* Success */ diff --git a/sys/dev/chromebook_platform/chromebook_platform.c b/sys/dev/chromebook_platform/chromebook_platform.c --- a/sys/dev/chromebook_platform/chromebook_platform.c +++ b/sys/dev/chromebook_platform/chromebook_platform.c @@ -70,7 +70,7 @@ return; for (i = 0; i < nitems(slaves); i++) { - if (device_find_child(bus, slaves[i].name, -1) != NULL) + if (device_find_child(bus, slaves[i].name, DEVICE_UNIT_ANY) != NULL) continue; if (slaves[i].pci_id != pci_get_devid(controller)) continue; diff --git a/sys/dev/coretemp/coretemp.c b/sys/dev/coretemp/coretemp.c --- a/sys/dev/coretemp/coretemp.c +++ b/sys/dev/coretemp/coretemp.c @@ -112,7 +112,7 @@ u_int regs[4]; /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "coretemp", -1) != NULL) + if (device_find_child(parent, "coretemp", DEVICE_UNIT_ANY) != NULL) return; /* Check that CPUID 0x06 is supported and the vendor is Intel.*/ diff --git a/sys/dev/cpufreq/cpufreq_dt.c b/sys/dev/cpufreq/cpufreq_dt.c --- a/sys/dev/cpufreq/cpufreq_dt.c +++ b/sys/dev/cpufreq/cpufreq_dt.c @@ -315,7 +315,7 @@ !OF_hasprop(node, "operating-points-v2")) return; - if (device_find_child(parent, "cpufreq_dt", -1) != NULL) + if (device_find_child(parent, "cpufreq_dt", DEVICE_UNIT_ANY) != NULL) return; if (BUS_ADD_CHILD(parent, 0, "cpufreq_dt", device_get_unit(parent)) diff --git a/sys/dev/cpufreq/ichss.c b/sys/dev/cpufreq/ichss.c --- a/sys/dev/cpufreq/ichss.c +++ b/sys/dev/cpufreq/ichss.c @@ -147,7 +147,7 @@ return; /* Avoid duplicates. */ - if (device_find_child(parent, "ichss", -1)) + if (device_find_child(parent, "ichss", DEVICE_UNIT_ANY)) return; /* @@ -218,13 +218,15 @@ * info, let it manage things. Also, if Enhanced SpeedStep is * available, don't attach. */ - perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1); + perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", + DEVICE_UNIT_ANY); if (perf_dev && device_is_attached(perf_dev)) { error = CPUFREQ_DRV_TYPE(perf_dev, &type); if (error == 0 && (type & CPUFREQ_FLAG_INFO_ONLY) == 0) return (ENXIO); } - est_dev = device_find_child(device_get_parent(dev), "est", -1); + est_dev = device_find_child(device_get_parent(dev), "est", + DEVICE_UNIT_ANY); if (est_dev && device_is_attached(est_dev)) return (ENXIO); diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c --- a/sys/dev/cxgb/cxgb_main.c +++ b/sys/dev/cxgb/cxgb_main.c @@ -622,7 +622,8 @@ for (i = 0; i < (sc)->params.nports; i++) { struct port_info *pi; - if ((child = device_add_child(dev, "cxgb", -1)) == NULL) { + if ((child = device_add_child(dev, "cxgb", + DEVICE_UNIT_ANY)) == NULL) { device_printf(dev, "failed to add child port\n"); error = EINVAL; goto out; diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -1804,7 +1804,7 @@ sc = device_get_softc(parent); if (sc->cryptocaps & FW_CAPS_CONFIG_CRYPTO_LOOKASIDE && - device_find_child(parent, "ccr", -1) == NULL) + device_find_child(parent, "ccr", DEVICE_UNIT_ANY) == NULL) device_add_child(parent, "ccr", DEVICE_UNIT_ANY); } diff --git a/sys/dev/dpaa2/dpaa2_mc_acpi.c b/sys/dev/dpaa2/dpaa2_mc_acpi.c --- a/sys/dev/dpaa2/dpaa2_mc_acpi.c +++ b/sys/dev/dpaa2/dpaa2_mc_acpi.c @@ -229,7 +229,7 @@ if ((ad = malloc(sizeof(*ad), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) return (AE_OK); - child = device_add_child(ctx->dev, "dpaa2_mac_dev", -1); + child = device_add_child(ctx->dev, "dpaa2_mac_dev", DEVICE_UNIT_ANY); if (child == NULL) { free(ad, M_DEVBUF); return (AE_OK); diff --git a/sys/dev/dpaa2/dpaa2_rc.c b/sys/dev/dpaa2/dpaa2_rc.c --- a/sys/dev/dpaa2/dpaa2_rc.c +++ b/sys/dev/dpaa2/dpaa2_rc.c @@ -2905,7 +2905,7 @@ } /* Add a device for the DPAA2 object. */ - dev = device_add_child(rcdev, devclass, -1); + dev = device_add_child(rcdev, devclass, DEVICE_UNIT_ANY); if (dev == NULL) { device_printf(rcdev, "%s: failed to add a device for DPAA2 " "object: type=%s, id=%u\n", __func__, dpaa2_ttos(obj->type), @@ -3031,7 +3031,7 @@ } /* Add a device for the DPAA2 object. */ - dev = device_add_child(rcdev, devclass, -1); + dev = device_add_child(rcdev, devclass, DEVICE_UNIT_ANY); if (dev == NULL) { device_printf(rcdev, "%s: failed to add a device for DPAA2 " "object: type=%s, id=%u\n", __func__, dpaa2_ttos(obj->type), diff --git a/sys/dev/dpaa2/memac_mdio_acpi.c b/sys/dev/dpaa2/memac_mdio_acpi.c --- a/sys/dev/dpaa2/memac_mdio_acpi.c +++ b/sys/dev/dpaa2/memac_mdio_acpi.c @@ -227,7 +227,7 @@ if ((ad = malloc(sizeof(*ad), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) return (AE_OK); - child = device_add_child(ctx->dev, "memacphy_acpi", -1); + child = device_add_child(ctx->dev, "memacphy_acpi", DEVICE_UNIT_ANY); if (child == NULL) { free(ad, M_DEVBUF); return (AE_OK); diff --git a/sys/dev/efidev/efirtc.c b/sys/dev/efidev/efirtc.c --- a/sys/dev/efidev/efirtc.c +++ b/sys/dev/efidev/efirtc.c @@ -52,9 +52,9 @@ /* Don't add the driver unless we have working runtime services. */ if (efi_rt_ok() != 0) return; - if (device_find_child(parent, "efirtc", -1) != NULL) + if (device_find_child(parent, "efirtc", DEVICE_UNIT_ANY) != NULL) return; - if (BUS_ADD_CHILD(parent, 0, "efirtc", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "efirtc", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add child failed\n"); } diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c --- a/sys/dev/etherswitch/e6000sw/e6000sw.c +++ b/sys/dev/etherswitch/e6000sw/e6000sw.c @@ -205,7 +205,7 @@ e6000sw_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "e6000sw", -1) == NULL) + if (device_find_child(parent, "e6000sw", DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, "e6000sw", DEVICE_UNIT_ANY); } diff --git a/sys/dev/etherswitch/etherswitch.c b/sys/dev/etherswitch/etherswitch.c --- a/sys/dev/etherswitch/etherswitch.c +++ b/sys/dev/etherswitch/etherswitch.c @@ -82,7 +82,7 @@ static void etherswitch_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "etherswitch", -1) == NULL) + if (device_find_child(parent, "etherswitch", DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, "etherswitch", DEVICE_UNIT_ANY); } diff --git a/sys/dev/etherswitch/ip17x/ip17x.c b/sys/dev/etherswitch/ip17x/ip17x.c --- a/sys/dev/etherswitch/ip17x/ip17x.c +++ b/sys/dev/etherswitch/ip17x/ip17x.c @@ -83,7 +83,7 @@ static void ip17x_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "ip17x", -1) == NULL) + if (device_find_child(parent, "ip17x", DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, "ip17x", DEVICE_UNIT_ANY); } diff --git a/sys/dev/etherswitch/miiproxy.c b/sys/dev/etherswitch/miiproxy.c --- a/sys/dev/etherswitch/miiproxy.c +++ b/sys/dev/etherswitch/miiproxy.c @@ -331,7 +331,7 @@ static void mdioproxy_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, driver->name, -1) == NULL) { + if (device_find_child(parent, driver->name, DEVICE_UNIT_ANY) == NULL) { BUS_ADD_CHILD(parent, 0, driver->name, DEVICE_UNIT_ANY); } } diff --git a/sys/dev/etherswitch/rtl8366/rtl8366rb.c b/sys/dev/etherswitch/rtl8366/rtl8366rb.c --- a/sys/dev/etherswitch/rtl8366/rtl8366rb.c +++ b/sys/dev/etherswitch/rtl8366/rtl8366rb.c @@ -133,7 +133,7 @@ device_t child; struct iicbus_ivar *devi; - if (device_find_child(parent, "rtl8366rb", -1) == NULL) { + if (device_find_child(parent, "rtl8366rb", DEVICE_UNIT_ANY) == NULL) { child = BUS_ADD_CHILD(parent, 0, "rtl8366rb", DEVICE_UNIT_ANY); devi = IICBUS_IVAR(child); devi->addr = RTL8366_IIC_ADDR; diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -303,7 +303,7 @@ printf("sbp_identify\n"); END_DEBUG - if (device_find_child(parent, "sbp", -1) == NULL) + if (device_find_child(parent, "sbp", DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, "sbp", DEVICE_UNIT_ANY); } diff --git a/sys/dev/glxiic/glxiic.c b/sys/dev/glxiic/glxiic.c --- a/sys/dev/glxiic/glxiic.c +++ b/sys/dev/glxiic/glxiic.c @@ -284,11 +284,11 @@ { /* Prevent child from being added more than once. */ - if (device_find_child(parent, driver->name, -1) != NULL) + if (device_find_child(parent, driver->name, DEVICE_UNIT_ANY) != NULL) return; if (pci_get_devid(parent) == GLXIIC_CS5536_DEV_ID) { - if (device_add_child(parent, driver->name, -1) == NULL) + if (device_add_child(parent, driver->name, DEVICE_UNIT_ANY) == NULL) device_printf(parent, "Could not add glxiic child\n"); } } @@ -390,7 +390,8 @@ goto out; } - if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL) { + if ((sc->iicbus = device_add_child(dev, "iicbus", + DEVICE_UNIT_ANY)) == NULL) { device_printf(dev, "Could not allocate iicbus instance\n"); error = ENXIO; goto out; diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -300,7 +300,7 @@ busdev = device_add_child(dev, "gpiobus", DEVICE_UNIT_ANY); if (busdev == NULL) return (NULL); - if (device_add_child(dev, "gpioc", -1) == NULL) { + if (device_add_child(dev, "gpioc", DEVICE_UNIT_ANY) == NULL) { device_delete_child(dev, busdev); return (NULL); } diff --git a/sys/dev/hid/hidraw.c b/sys/dev/hid/hidraw.c --- a/sys/dev/hid/hidraw.c +++ b/sys/dev/hid/hidraw.c @@ -183,7 +183,7 @@ { device_t child; - if (device_find_child(parent, "hidraw", -1) == NULL) { + if (device_find_child(parent, "hidraw", DEVICE_UNIT_ANY) == NULL) { child = BUS_ADD_CHILD(parent, 0, "hidraw", device_get_unit(parent)); if (child != NULL) diff --git a/sys/dev/hyperv/input/hv_hid.c b/sys/dev/hyperv/input/hv_hid.c --- a/sys/dev/hyperv/input/hv_hid.c +++ b/sys/dev/hyperv/input/hv_hid.c @@ -436,7 +436,7 @@ ret = ENODEV; goto out; } - child = device_add_child(sc->dev, "hidbus", -1); + child = device_add_child(sc->dev, "hidbus", DEVICE_UNIT_ANY); if (child == NULL) { device_printf(sc->dev, "failed to add hidbus\n"); ret = ENOMEM; diff --git a/sys/dev/hyperv/vmbus/vmbus_et.c b/sys/dev/hyperv/vmbus/vmbus_et.c --- a/sys/dev/hyperv/vmbus/vmbus_et.c +++ b/sys/dev/hyperv/vmbus/vmbus_et.c @@ -127,7 +127,7 @@ vmbus_et_identify(driver_t *driver, device_t parent) { if (device_get_unit(parent) != 0 || - device_find_child(parent, VMBUS_ET_NAME, -1) != NULL || + device_find_child(parent, VMBUS_ET_NAME, DEVICE_UNIT_ANY) != NULL || (hyperv_features & CPUID_HV_ET_MASK) != CPUID_HV_ET_MASK || hyperv_tc64 == NULL) return; diff --git a/sys/dev/ichsmb/ichsmb.c b/sys/dev/ichsmb/ichsmb.c --- a/sys/dev/ichsmb/ichsmb.c +++ b/sys/dev/ichsmb/ichsmb.c @@ -112,7 +112,8 @@ mtx_init(&sc->mutex, device_get_nameunit(dev), "ichsmb", MTX_DEF); /* Add child: an instance of the "smbus" device */ - if ((sc->smb = device_add_child(dev, DRIVER_SMBUS, -1)) == NULL) { + if ((sc->smb = device_add_child(dev, DRIVER_SMBUS, + DEVICE_UNIT_ANY)) == NULL) { device_printf(dev, "no \"%s\" child found\n", DRIVER_SMBUS); error = ENXIO; goto fail; diff --git a/sys/dev/iicbus/controller/cadence/cdnc_i2c.c b/sys/dev/iicbus/controller/cadence/cdnc_i2c.c --- a/sys/dev/iicbus/controller/cadence/cdnc_i2c.c +++ b/sys/dev/iicbus/controller/cadence/cdnc_i2c.c @@ -612,7 +612,7 @@ return (err); } - sc->iicbus = device_add_child(dev, "iicbus", -1); + sc->iicbus = device_add_child(dev, "iicbus", DEVICE_UNIT_ANY); cdnc_i2c_add_sysctls(dev); diff --git a/sys/dev/iicbus/controller/twsi/twsi.c b/sys/dev/iicbus/controller/twsi/twsi.c --- a/sys/dev/iicbus/controller/twsi/twsi.c +++ b/sys/dev/iicbus/controller/twsi/twsi.c @@ -812,7 +812,8 @@ &sc->debug, 0, "Set debug level (zero to disable)"); /* Attach the iicbus. */ - if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL) { + if ((sc->iicbus = device_add_child(dev, "iicbus", + DEVICE_UNIT_ANY)) == NULL) { device_printf(dev, "could not allocate iicbus instance\n"); twsi_detach(dev); return (ENXIO); diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c --- a/sys/dev/iicbus/iic.c +++ b/sys/dev/iicbus/iic.c @@ -133,7 +133,7 @@ iic_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "iic", -1) == NULL) + if (device_find_child(parent, "iic", DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, "iic", DEVICE_UNIT_ANY); } diff --git a/sys/dev/iicbus/iicsmb.c b/sys/dev/iicbus/iicsmb.c --- a/sys/dev/iicbus/iicsmb.c +++ b/sys/dev/iicbus/iicsmb.c @@ -134,7 +134,7 @@ iicsmb_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "iicsmb", -1) == NULL) + if (device_find_child(parent, "iicsmb", DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, "iicsmb", DEVICE_UNIT_ANY); } diff --git a/sys/dev/ipmi/ipmi_isa.c b/sys/dev/ipmi/ipmi_isa.c --- a/sys/dev/ipmi/ipmi_isa.c +++ b/sys/dev/ipmi/ipmi_isa.c @@ -57,7 +57,7 @@ uint32_t devid; if (ipmi_smbios_identify(&info) && info.iface_type != SSIF_MODE && - device_find_child(parent, "ipmi", -1) == NULL) { + device_find_child(parent, "ipmi", DEVICE_UNIT_ANY) == NULL) { /* * XXX: Hack alert. On some broken systems, the IPMI * interface is described via SMBIOS, but the actual diff --git a/sys/dev/ipmi/ipmi_smbus.c b/sys/dev/ipmi/ipmi_smbus.c --- a/sys/dev/ipmi/ipmi_smbus.c +++ b/sys/dev/ipmi/ipmi_smbus.c @@ -59,7 +59,7 @@ struct ipmi_get_info info; if (ipmi_smbios_identify(&info) && info.iface_type == SSIF_MODE && - device_find_child(parent, "ipmi", -1) == NULL) + device_find_child(parent, "ipmi", DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, "ipmi", DEVICE_UNIT_ANY); } diff --git a/sys/dev/isl/isl.c b/sys/dev/isl/isl.c --- a/sys/dev/isl/isl.c +++ b/sys/dev/isl/isl.c @@ -149,7 +149,7 @@ isl_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "asl", -1)) { + if (device_find_child(parent, "asl", DEVICE_UNIT_ANY)) { if (bootverbose) printf("asl: device(s) already created\n"); return; diff --git a/sys/dev/ismt/ismt.c b/sys/dev/ismt/ismt.c --- a/sys/dev/ismt/ismt.c +++ b/sys/dev/ismt/ismt.c @@ -586,7 +586,8 @@ sc->pcidev = dev; pci_enable_busmaster(dev); - if ((sc->smbdev = device_add_child(dev, "smbus", -1)) == NULL) { + if ((sc->smbdev = device_add_child(dev, "smbus", + DEVICE_UNIT_ANY)) == NULL) { device_printf(dev, "no smbus child found\n"); err = ENXIO; goto fail; diff --git a/sys/dev/kvm_clock/kvm_clock.c b/sys/dev/kvm_clock/kvm_clock.c --- a/sys/dev/kvm_clock/kvm_clock.c +++ b/sys/dev/kvm_clock/kvm_clock.c @@ -141,7 +141,7 @@ if ((regs[0] & (KVM_FEATURE_CLOCKSOURCE2 | KVM_FEATURE_CLOCKSOURCE)) == 0) return; - if (device_find_child(parent, KVM_CLOCK_DEVNAME, -1)) + if (device_find_child(parent, KVM_CLOCK_DEVNAME, DEVICE_UNIT_ANY)) return; BUS_ADD_CHILD(parent, 0, KVM_CLOCK_DEVNAME, 0); } diff --git a/sys/dev/mdio/mdio.c b/sys/dev/mdio/mdio.c --- a/sys/dev/mdio/mdio.c +++ b/sys/dev/mdio/mdio.c @@ -37,7 +37,7 @@ mdio_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, mdio_driver.name, -1) == NULL) + if (device_find_child(parent, mdio_driver.name, DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, mdio_driver.name, DEVICE_UNIT_ANY); } diff --git a/sys/dev/mfi/mfi.c b/sys/dev/mfi/mfi.c --- a/sys/dev/mfi/mfi.c +++ b/sys/dev/mfi/mfi.c @@ -1922,7 +1922,8 @@ mtx_unlock(&sc->mfi_io_lock); bus_topo_lock(); - if ((child = device_add_child(sc->mfi_dev, "mfid", -1)) == NULL) { + if ((child = device_add_child(sc->mfi_dev, "mfid", + DEVICE_UNIT_ANY)) == NULL) { device_printf(sc->mfi_dev, "Failed to add logical disk\n"); free(ld_info, M_MFIBUF); bus_topo_unlock(); @@ -2010,7 +2011,8 @@ mtx_unlock(&sc->mfi_io_lock); bus_topo_lock(); - if ((child = device_add_child(sc->mfi_dev, "mfisyspd", -1)) == NULL) { + if ((child = device_add_child(sc->mfi_dev, "mfisyspd", + DEVICE_UNIT_ANY)) == NULL) { device_printf(sc->mfi_dev, "Failed to add system pd\n"); free(pd_info, M_MFIBUF); bus_topo_unlock(); diff --git a/sys/dev/mfi/mfi_cam.c b/sys/dev/mfi/mfi_cam.c --- a/sys/dev/mfi/mfi_cam.c +++ b/sys/dev/mfi/mfi_cam.c @@ -298,7 +298,7 @@ device_t mfip_dev; bus_topo_lock(); - mfip_dev = device_find_child(sc->mfi_dev, "mfip", -1); + mfip_dev = device_find_child(sc->mfi_dev, "mfip", DEVICE_UNIT_ANY); bus_topo_unlock(); if (mfip_dev == NULL) { device_printf(sc->mfi_dev, "Couldn't find mfip child device!\n"); diff --git a/sys/dev/mmcnull/mmcnull.c b/sys/dev/mmcnull/mmcnull.c --- a/sys/dev/mmcnull/mmcnull.c +++ b/sys/dev/mmcnull/mmcnull.c @@ -77,7 +77,7 @@ return; /* Avoid duplicates. */ - if (device_find_child(parent, "mmcnull", -1)) + if (device_find_child(parent, "mmcnull", DEVICE_UNIT_ANY)) return; child = BUS_ADD_CHILD(parent, 20, "mmcnull", 0); diff --git a/sys/dev/nvdimm/nvdimm_e820.c b/sys/dev/nvdimm/nvdimm_e820.c --- a/sys/dev/nvdimm/nvdimm_e820.c +++ b/sys/dev/nvdimm/nvdimm_e820.c @@ -261,7 +261,7 @@ if (resource_disabled(driver->name, 0)) return; /* Just create a single instance of the fake bus. */ - if (device_find_child(parent, driver->name, -1) != NULL) + if (device_find_child(parent, driver->name, DEVICE_UNIT_ANY) != NULL) return; smapbase = (const void *)preload_search_info(preload_kmdp, diff --git a/sys/dev/nvmf/host/nvmf_ctldev.c b/sys/dev/nvmf/host/nvmf_ctldev.c --- a/sys/dev/nvmf/host/nvmf_ctldev.c +++ b/sys/dev/nvmf/host/nvmf_ctldev.c @@ -29,7 +29,7 @@ return (error); bus_topo_lock(); - dev = device_add_child(root_bus, "nvme", -1); + dev = device_add_child(root_bus, "nvme", DEVICE_UNIT_ANY); if (dev == NULL) { bus_topo_unlock(); error = ENXIO; diff --git a/sys/dev/p2sb/lewisburg_gpiocm.c b/sys/dev/p2sb/lewisburg_gpiocm.c --- a/sys/dev/p2sb/lewisburg_gpiocm.c +++ b/sys/dev/p2sb/lewisburg_gpiocm.c @@ -315,7 +315,7 @@ group->npins = npins < MAX_PAD_PER_GROUP ? npins : MAX_PAD_PER_GROUP; npins -= group->npins; - group->dev = device_add_child(dev, "gpio", -1); + group->dev = device_add_child(dev, "gpio", DEVICE_UNIT_ANY); } sc->community->ngroups = i; bus_attach_children(dev); diff --git a/sys/dev/pcf/pcf_isa.c b/sys/dev/pcf/pcf_isa.c --- a/sys/dev/pcf/pcf_isa.c +++ b/sys/dev/pcf/pcf_isa.c @@ -160,7 +160,7 @@ } } - if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL) + if ((sc->iicbus = device_add_child(dev, "iicbus", DEVICE_UNIT_ANY)) == NULL) device_printf(dev, "could not allocate iicbus instance\n"); /* probe and attach the iicbus */ diff --git a/sys/dev/pci/pci_host_generic_den0115.c b/sys/dev/pci/pci_host_generic_den0115.c --- a/sys/dev/pci/pci_host_generic_den0115.c +++ b/sys/dev/pci/pci_host_generic_den0115.c @@ -193,7 +193,7 @@ sc->base.bus_end = MIN(sc->base.bus_end, end); } - device_add_child(dev, "pci", -1); + device_add_child(dev, "pci", DEVICE_UNIT_ANY); bus_attach_children(dev); return (0); } diff --git a/sys/dev/ppbus/if_plip.c b/sys/dev/ppbus/if_plip.c --- a/sys/dev/ppbus/if_plip.c +++ b/sys/dev/ppbus/if_plip.c @@ -214,7 +214,7 @@ { device_t dev; - dev = device_find_child(parent, "plip", -1); + dev = device_find_child(parent, "plip", DEVICE_UNIT_ANY); if (!dev) BUS_ADD_CHILD(parent, 0, "plip", DEVICE_UNIT_ANY); } diff --git a/sys/dev/ppbus/lpbb.c b/sys/dev/ppbus/lpbb.c --- a/sys/dev/ppbus/lpbb.c +++ b/sys/dev/ppbus/lpbb.c @@ -61,7 +61,7 @@ device_t dev; - dev = device_find_child(parent, "lpbb", -1); + dev = device_find_child(parent, "lpbb", DEVICE_UNIT_ANY); if (!dev) BUS_ADD_CHILD(parent, 0, "lpbb", DEVICE_UNIT_ANY); } diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -336,7 +336,7 @@ device_t dev; - dev = device_find_child(parent, LPT_NAME, -1); + dev = device_find_child(parent, LPT_NAME, DEVICE_UNIT_ANY); if (!dev) BUS_ADD_CHILD(parent, 0, LPT_NAME, DEVICE_UNIT_ANY); } diff --git a/sys/dev/ppbus/pcfclock.c b/sys/dev/ppbus/pcfclock.c --- a/sys/dev/ppbus/pcfclock.c +++ b/sys/dev/ppbus/pcfclock.c @@ -111,7 +111,7 @@ device_t dev; - dev = device_find_child(parent, PCFCLOCK_NAME, -1); + dev = device_find_child(parent, PCFCLOCK_NAME, DEVICE_UNIT_ANY); if (!dev) BUS_ADD_CHILD(parent, 0, PCFCLOCK_NAME, DEVICE_UNIT_ANY); } diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c --- a/sys/dev/ppbus/ppi.c +++ b/sys/dev/ppbus/ppi.c @@ -135,7 +135,7 @@ device_t dev; - dev = device_find_child(parent, "ppi", -1); + dev = device_find_child(parent, "ppi", DEVICE_UNIT_ANY); if (!dev) BUS_ADD_CHILD(parent, 0, "ppi", DEVICE_UNIT_ANY); } diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -76,7 +76,7 @@ device_t dev; - dev = device_find_child(parent, PPS_NAME, -1); + dev = device_find_child(parent, PPS_NAME, DEVICE_UNIT_ANY); if (!dev) BUS_ADD_CHILD(parent, 0, PPS_NAME, DEVICE_UNIT_ANY); } diff --git a/sys/dev/psci/smccc_errata.c b/sys/dev/psci/smccc_errata.c --- a/sys/dev/psci/smccc_errata.c +++ b/sys/dev/psci/smccc_errata.c @@ -78,7 +78,7 @@ if (version < EM_VERSION_MIN) return; - if (BUS_ADD_CHILD(parent, 0, "errata", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "errata", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add errata child failed\n"); } diff --git a/sys/dev/psci/smccc_trng.c b/sys/dev/psci/smccc_trng.c --- a/sys/dev/psci/smccc_trng.c +++ b/sys/dev/psci/smccc_trng.c @@ -78,7 +78,7 @@ if (version < TRNG_VERSION_MIN) return; - if (BUS_ADD_CHILD(parent, 0, "trng", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "trng", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add TRNG child failed\n"); } diff --git a/sys/dev/pwm/ofw_pwmbus.c b/sys/dev/pwm/ofw_pwmbus.c --- a/sys/dev/pwm/ofw_pwmbus.c +++ b/sys/dev/pwm/ofw_pwmbus.c @@ -150,7 +150,8 @@ if (chan >= sc->base.nchannels) continue; - if ((child = ofw_pwmbus_add_child(dev, 0, NULL, -1)) == NULL) + if ((child = ofw_pwmbus_add_child(dev, 0, NULL, + DEVICE_UNIT_ANY)) == NULL) continue; ivars = device_get_ivars(child); @@ -173,7 +174,8 @@ */ if (!any_children) { for (chan = 0; chan < sc->base.nchannels; ++chan) { - child = ofw_pwmbus_add_child(dev, 0, "pwmc", -1); + child = ofw_pwmbus_add_child(dev, 0, "pwmc", + DEVICE_UNIT_ANY); if (child == NULL) { device_printf(dev, "failed to add pwmc child " " device for channel %u\n", chan); diff --git a/sys/dev/qat/qat/qat_ocf.c b/sys/dev/qat/qat/qat_ocf.c --- a/sys/dev/qat/qat/qat_ocf.c +++ b/sys/dev/qat/qat/qat_ocf.c @@ -941,8 +941,8 @@ static void qat_ocf_identify(driver_t *drv, device_t parent) { - if (device_find_child(parent, "qat_ocf", -1) == NULL && - BUS_ADD_CHILD(parent, 200, "qat_ocf", -1) == 0) + if (device_find_child(parent, "qat_ocf", DEVICE_UNIT_ANY) == NULL && + BUS_ADD_CHILD(parent, 200, "qat_ocf", DEVICE_UNIT_ANY) == 0) device_printf(parent, "qat_ocf: could not attach!"); } diff --git a/sys/dev/qcom_qup/qcom_spi.c b/sys/dev/qcom_qup/qcom_spi.c --- a/sys/dev/qcom_qup/qcom_spi.c +++ b/sys/dev/qcom_qup/qcom_spi.c @@ -420,7 +420,7 @@ } QCOM_SPI_UNLOCK(sc); - sc->spibus = device_add_child(dev, "spibus", -1); + sc->spibus = device_add_child(dev, "spibus", DEVICE_UNIT_ANY); /* We're done, so shut down the interface clock for now */ device_printf(dev, "DONE: shutting down interface clock for now\n"); diff --git a/sys/dev/sdio/sdiob.c b/sys/dev/sdio/sdiob.c --- a/sys/dev/sdio/sdiob.c +++ b/sys/dev/sdio/sdiob.c @@ -923,7 +923,7 @@ __func__, sc, sc->periph, sc->periph->sim)); if (sc->dev == NULL) - sc->dev = BUS_ADD_CHILD(pdev, 0, SDIOB_NAME_S, -1); + sc->dev = BUS_ADD_CHILD(pdev, 0, SDIOB_NAME_S, DEVICE_UNIT_ANY); if (sc->dev == NULL) return (ENXIO); device_set_softc(sc->dev, sc); diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c --- a/sys/dev/smbus/smb.c +++ b/sys/dev/smbus/smb.c @@ -126,7 +126,7 @@ smb_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "smb", -1) == NULL) + if (device_find_child(parent, "smb", DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, "smb", DEVICE_UNIT_ANY); } diff --git a/sys/dev/sound/dummy.c b/sys/dev/sound/dummy.c --- a/sys/dev/sound/dummy.c +++ b/sys/dev/sound/dummy.c @@ -296,9 +296,9 @@ static void dummy_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, driver->name, -1) != NULL) + if (device_find_child(parent, driver->name, DEVICE_UNIT_ANY) != NULL) return; - if (BUS_ADD_CHILD(parent, 0, driver->name, -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, driver->name, DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add child failed\n"); } diff --git a/sys/dev/sound/pci/hdsp.c b/sys/dev/sound/pci/hdsp.c --- a/sys/dev/sound/pci/hdsp.c +++ b/sys/dev/sound/pci/hdsp.c @@ -890,7 +890,7 @@ scp = malloc(sizeof(struct sc_pcminfo), M_DEVBUF, M_WAITOK | M_ZERO); scp->hc = &chan_map[i]; scp->sc = sc; - scp->dev = device_add_child(dev, "pcm", -1); + scp->dev = device_add_child(dev, "pcm", DEVICE_UNIT_ANY); device_set_ivars(scp->dev, scp); } diff --git a/sys/dev/spibus/acpi_spibus.c b/sys/dev/spibus/acpi_spibus.c --- a/sys/dev/spibus/acpi_spibus.c +++ b/sys/dev/spibus/acpi_spibus.c @@ -302,7 +302,7 @@ if (acpi_spibus_delete_acpi_child(handle) != 0) return (AE_OK); - child = BUS_ADD_CHILD(spibus, 0, NULL, -1); + child = BUS_ADD_CHILD(spibus, 0, NULL, DEVICE_UNIT_ANY); if (child == NULL) { device_printf(spibus, "add child failed\n"); return (AE_OK); diff --git a/sys/dev/superio/superio.c b/sys/dev/superio/superio.c --- a/sys/dev/superio/superio.c +++ b/sys/dev/superio/superio.c @@ -633,7 +633,7 @@ * Those could be created via isa hints or if this * driver is loaded, unloaded and then loaded again. */ - if (device_find_child(parent, "superio", -1)) { + if (device_find_child(parent, "superio", DEVICE_UNIT_ANY)) { if (bootverbose) printf("superio: device(s) already created\n"); return; diff --git a/sys/dev/usb/misc/i2ctinyusb.c b/sys/dev/usb/misc/i2ctinyusb.c --- a/sys/dev/usb/misc/i2ctinyusb.c +++ b/sys/dev/usb/misc/i2ctinyusb.c @@ -167,7 +167,7 @@ sc->sc_udev = uaa->device; mtx_init(&sc->sc_mtx, "i2ctinyusb lock", NULL, MTX_DEF | MTX_RECURSE); - sc->iicbus_dev = device_add_child(dev, "iicbus", -1); + sc->iicbus_dev = device_add_child(dev, "iicbus", DEVICE_UNIT_ANY); if (sc->iicbus_dev == NULL) { device_printf(dev, "iicbus creation failed\n"); err = ENXIO; diff --git a/sys/dev/viapm/viapm.c b/sys/dev/viapm/viapm.c --- a/sys/dev/viapm/viapm.c +++ b/sys/dev/viapm/viapm.c @@ -423,7 +423,7 @@ VIAPM_OUTB(GPIO_DIR, VIAPM_INB(GPIO_DIR) | VIAPM_SCL | VIAPM_SDA); /* add generic bit-banging code */ - if (!(viapm->iicbb = device_add_child(dev, "iicbb", -1))) + if (!(viapm->iicbb = device_add_child(dev, "iicbb", DEVICE_UNIT_ANY))) goto error; bus_attach_children(dev); diff --git a/sys/dev/viawd/viawd.c b/sys/dev/viawd/viawd.c --- a/sys/dev/viawd/viawd.c +++ b/sys/dev/viawd/viawd.c @@ -125,7 +125,7 @@ if (viawd_find(parent) == NULL) return; - if (device_find_child(parent, driver->name, -1) == NULL) + if (device_find_child(parent, driver->name, DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, driver->name, 0); } diff --git a/sys/dev/virtio/mmio/virtio_mmio.c b/sys/dev/virtio/mmio/virtio_mmio.c --- a/sys/dev/virtio/mmio/virtio_mmio.c +++ b/sys/dev/virtio/mmio/virtio_mmio.c @@ -275,7 +275,7 @@ /* Tell the host we've noticed this device. */ vtmmio_set_status(dev, VIRTIO_CONFIG_STATUS_ACK); - if ((child = device_add_child(dev, NULL, -1)) == NULL) { + if ((child = device_add_child(dev, NULL, DEVICE_UNIT_ANY)) == NULL) { device_printf(dev, "Cannot create child device.\n"); vtmmio_set_status(dev, VIRTIO_CONFIG_STATUS_FAILED); vtmmio_detach(dev); diff --git a/sys/isa/isahint.c b/sys/isa/isahint.c --- a/sys/isa/isahint.c +++ b/sys/isa/isahint.c @@ -45,7 +45,8 @@ /* device-specific flag overrides any wildcard */ sensitive = 0; if (resource_int_value(name, unit, "sensitive", &sensitive) != 0) - resource_int_value(name, -1, "sensitive", &sensitive); + resource_int_value(name, DEVICE_UNIT_ANY, "sensitive", + &sensitive); if (sensitive) order = ISA_ORDER_SENSITIVE; diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c --- a/sys/kern/kern_cpu.c +++ b/sys/kern/kern_cpu.c @@ -1101,7 +1101,7 @@ * must offer the same levels and be switched at the same time. */ cpu_dev = device_get_parent(dev); - if ((cf_dev = device_find_child(cpu_dev, "cpufreq", -1))) { + if ((cf_dev = device_find_child(cpu_dev, "cpufreq", DEVICE_UNIT_ANY))) { sc = device_get_softc(cf_dev); sc->max_mhz = CPUFREQ_VAL_UNKNOWN; MPASS(sc->cf_drv_dev != NULL); @@ -1135,7 +1135,8 @@ * device as well. We identify cpufreq children by calling a method * they support. */ - cf_dev = device_find_child(device_get_parent(dev), "cpufreq", -1); + cf_dev = device_find_child(device_get_parent(dev), "cpufreq", + DEVICE_UNIT_ANY); if (cf_dev == NULL) { device_printf(dev, "warning: cpufreq_unregister called with no cpufreq device active\n"); diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1686,7 +1686,7 @@ swcr_identify(driver_t *drv, device_t parent) { /* NB: order 10 is so we get attached after h/w devices */ - if (device_find_child(parent, "cryptosoft", -1) == NULL && + if (device_find_child(parent, "cryptosoft", DEVICE_UNIT_ANY) == NULL && BUS_ADD_CHILD(parent, 10, "cryptosoft", 0) == 0) panic("cryptosoft: could not attach"); } diff --git a/sys/powerpc/cpufreq/dfs.c b/sys/powerpc/cpufreq/dfs.c --- a/sys/powerpc/cpufreq/dfs.c +++ b/sys/powerpc/cpufreq/dfs.c @@ -94,14 +94,14 @@ } /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "dfs", -1) != NULL) + if (device_find_child(parent, "dfs", DEVICE_UNIT_ANY) != NULL) return; /* * We attach a child for every CPU since settings need to * be performed on every CPU in the SMP case. */ - if (BUS_ADD_CHILD(parent, 10, "dfs", -1) == NULL) + if (BUS_ADD_CHILD(parent, 10, "dfs", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add dfs child failed\n"); } diff --git a/sys/powerpc/cpufreq/mpc85xx_jog.c b/sys/powerpc/cpufreq/mpc85xx_jog.c --- a/sys/powerpc/cpufreq/mpc85xx_jog.c +++ b/sys/powerpc/cpufreq/mpc85xx_jog.c @@ -143,7 +143,7 @@ struct ofw_compat_data *compat; /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "mpc85xx_jog", -1) != NULL) + if (device_find_child(parent, "mpc85xx_jog", DEVICE_UNIT_ANY) != NULL) return; compat = mpc85xx_jog_devcompat(); @@ -154,7 +154,7 @@ * We attach a child for every CPU since settings need to * be performed on every CPU in the SMP case. */ - if (BUS_ADD_CHILD(parent, 10, "jog", -1) == NULL) + if (BUS_ADD_CHILD(parent, 10, "jog", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add jog child failed\n"); } diff --git a/sys/powerpc/cpufreq/pcr.c b/sys/powerpc/cpufreq/pcr.c --- a/sys/powerpc/cpufreq/pcr.c +++ b/sys/powerpc/cpufreq/pcr.c @@ -165,14 +165,14 @@ } /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "pcr", -1) != NULL) + if (device_find_child(parent, "pcr", DEVICE_UNIT_ANY) != NULL) return; /* * We attach a child for every CPU since settings need to * be performed on every CPU in the SMP case. */ - if (BUS_ADD_CHILD(parent, 10, "pcr", -1) == NULL) + if (BUS_ADD_CHILD(parent, 10, "pcr", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add pcr child failed\n"); } diff --git a/sys/powerpc/cpufreq/pmcr.c b/sys/powerpc/cpufreq/pmcr.c --- a/sys/powerpc/cpufreq/pmcr.c +++ b/sys/powerpc/cpufreq/pmcr.c @@ -115,14 +115,14 @@ { /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "pmcr", -1) != NULL) + if (device_find_child(parent, "pmcr", DEVICE_UNIT_ANY) != NULL) return; /* * We attach a child for every CPU since settings need to * be performed on every CPU in the SMP case. */ - if (BUS_ADD_CHILD(parent, 10, "pmcr", -1) == NULL) + if (BUS_ADD_CHILD(parent, 10, "pmcr", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add pmcr child failed\n"); } diff --git a/sys/powerpc/cpufreq/pmufreq.c b/sys/powerpc/cpufreq/pmufreq.c --- a/sys/powerpc/cpufreq/pmufreq.c +++ b/sys/powerpc/cpufreq/pmufreq.c @@ -89,14 +89,14 @@ return; /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "pmufreq", -1) != NULL) + if (device_find_child(parent, "pmufreq", DEVICE_UNIT_ANY) != NULL) return; /* * We attach a child for every CPU since settings need to * be performed on every CPU in the SMP case. */ - if (BUS_ADD_CHILD(parent, 10, "pmufreq", -1) == NULL) + if (BUS_ADD_CHILD(parent, 10, "pmufreq", DEVICE_UNIT_ANY) == NULL) device_printf(parent, "add pmufreq child failed\n"); } diff --git a/sys/powerpc/powermac/atibl.c b/sys/powerpc/powermac/atibl.c --- a/sys/powerpc/powermac/atibl.c +++ b/sys/powerpc/powermac/atibl.c @@ -105,7 +105,7 @@ { if (OF_finddevice("mac-io/backlight") == -1) return; - if (device_find_child(parent, "backlight", -1) == NULL) + if (device_find_child(parent, "backlight", DEVICE_UNIT_ANY) == NULL) device_add_child(parent, "backlight", DEVICE_UNIT_ANY); } diff --git a/sys/powerpc/powermac/nvbl.c b/sys/powerpc/powermac/nvbl.c --- a/sys/powerpc/powermac/nvbl.c +++ b/sys/powerpc/powermac/nvbl.c @@ -83,7 +83,7 @@ { if (OF_finddevice("mac-io/backlight") == -1) return; - if (device_find_child(parent, "backlight", -1) == NULL) + if (device_find_child(parent, "backlight", DEVICE_UNIT_ANY) == NULL) device_add_child(parent, "backlight", DEVICE_UNIT_ANY); } diff --git a/sys/powerpc/powernv/opal_i2c.c b/sys/powerpc/powernv/opal_i2c.c --- a/sys/powerpc/powernv/opal_i2c.c +++ b/sys/powerpc/powernv/opal_i2c.c @@ -137,7 +137,8 @@ return (EINVAL); OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-id", &sc->opal_id, len); - if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL) { + if ((sc->iicbus = device_add_child(dev, "iicbus", + DEVICE_UNIT_ANY)) == NULL) { device_printf(dev, "could not allocate iicbus instance\n"); return (EINVAL); } diff --git a/sys/powerpc/ps3/ps3bus.c b/sys/powerpc/ps3/ps3bus.c --- a/sys/powerpc/ps3/ps3bus.c +++ b/sys/powerpc/ps3/ps3bus.c @@ -157,7 +157,7 @@ if (strcmp(installed_platform(), "ps3") != 0) return; - if (device_find_child(parent, "ps3bus", -1) == NULL) + if (device_find_child(parent, "ps3bus", DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, "ps3bus", 0); } diff --git a/sys/powerpc/ps3/ps3pic.c b/sys/powerpc/ps3/ps3pic.c --- a/sys/powerpc/ps3/ps3pic.c +++ b/sys/powerpc/ps3/ps3pic.c @@ -99,7 +99,7 @@ if (strcmp(installed_platform(), "ps3") != 0) return; - if (device_find_child(parent, "ps3pic", -1) == NULL) + if (device_find_child(parent, "ps3pic", DEVICE_UNIT_ANY) == NULL) BUS_ADD_CHILD(parent, 0, "ps3pic", 0); } diff --git a/sys/riscv/riscv/intc.c b/sys/riscv/riscv/intc.c --- a/sys/riscv/riscv/intc.c +++ b/sys/riscv/riscv/intc.c @@ -127,7 +127,7 @@ device_t dev; phandle_t node; - if (device_find_child(parent, "intc", -1) != NULL) + if (device_find_child(parent, "intc", DEVICE_UNIT_ANY) != NULL) return; node = intc_ofw_find(parent, PCPU_GET(hart)); diff --git a/sys/riscv/riscv/sbi.c b/sys/riscv/riscv/sbi.c --- a/sys/riscv/riscv/sbi.c +++ b/sys/riscv/riscv/sbi.c @@ -351,10 +351,10 @@ { device_t dev; - if (device_find_child(parent, "sbi", -1) != NULL) + if (device_find_child(parent, "sbi", DEVICE_UNIT_ANY) != NULL) return; - dev = BUS_ADD_CHILD(parent, 0, "sbi", -1); + dev = BUS_ADD_CHILD(parent, 0, "sbi", DEVICE_UNIT_ANY); if (dev == NULL) device_printf(parent, "Can't add sbi child\n"); } @@ -389,7 +389,7 @@ #ifdef SMP di = malloc(sizeof(*di), M_DEVBUF, M_WAITOK | M_ZERO); resource_list_init(&di->rl); - child = device_add_child(dev, "sbi_ipi", -1); + child = device_add_child(dev, "sbi_ipi", DEVICE_UNIT_ANY); if (child == NULL) { device_printf(dev, "Could not add sbi_ipi child\n"); return (ENXIO); diff --git a/sys/x86/cpufreq/est.c b/sys/x86/cpufreq/est.c --- a/sys/x86/cpufreq/est.c +++ b/sys/x86/cpufreq/est.c @@ -920,11 +920,11 @@ * future. */ intel_hwpstate_identify(NULL, parent); - if (device_find_child(parent, "hwpstate_intel", -1) != NULL) + if (device_find_child(parent, "hwpstate_intel", DEVICE_UNIT_ANY) != NULL) return; /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "est", -1) != NULL) + if (device_find_child(parent, "est", DEVICE_UNIT_ANY) != NULL) return; /* Check that CPUID is supported and the vendor is Intel.*/ @@ -961,7 +961,8 @@ * If the ACPI perf driver has attached and is not just offering * info, let it manage things. */ - perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1); + perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", + DEVICE_UNIT_ANY); if (perf_dev && device_is_attached(perf_dev)) { error = CPUFREQ_DRV_TYPE(perf_dev, &type); if (error == 0 && (type & CPUFREQ_FLAG_INFO_ONLY) == 0) @@ -1064,7 +1065,8 @@ int count, error, i, j; uint16_t saved_id16; - perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1); + perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", + DEVICE_UNIT_ANY); if (perf_dev == NULL || !device_is_attached(perf_dev)) return (ENXIO); diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c --- a/sys/x86/cpufreq/hwpstate_amd.c +++ b/sys/x86/cpufreq/hwpstate_amd.c @@ -342,7 +342,7 @@ hwpstate_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "hwpstate", -1) != NULL) + if (device_find_child(parent, "hwpstate", DEVICE_UNIT_ANY) != NULL) return; if ((cpu_vendor_id != CPU_VENDOR_AMD || CPUID_TO_FAMILY(cpu_id) < 0x10) && @@ -386,7 +386,8 @@ /* * Check if acpi_perf has INFO only flag. */ - perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1); + perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", + DEVICE_UNIT_ANY); error = TRUE; if (perf_dev && device_is_attached(perf_dev)) { error = CPUFREQ_DRV_TYPE(perf_dev, &type); diff --git a/sys/x86/cpufreq/hwpstate_intel.c b/sys/x86/cpufreq/hwpstate_intel.c --- a/sys/x86/cpufreq/hwpstate_intel.c +++ b/sys/x86/cpufreq/hwpstate_intel.c @@ -328,7 +328,7 @@ void intel_hwpstate_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "hwpstate_intel", -1) != NULL) + if (device_find_child(parent, "hwpstate_intel", DEVICE_UNIT_ANY) != NULL) return; if (cpu_vendor_id != CPU_VENDOR_INTEL) diff --git a/sys/x86/cpufreq/p4tcc.c b/sys/x86/cpufreq/p4tcc.c --- a/sys/x86/cpufreq/p4tcc.c +++ b/sys/x86/cpufreq/p4tcc.c @@ -122,7 +122,7 @@ return; /* Make sure we're not being doubly invoked. */ - if (device_find_child(parent, "p4tcc", -1) != NULL) + if (device_find_child(parent, "p4tcc", DEVICE_UNIT_ANY) != NULL) return; /* diff --git a/sys/x86/cpufreq/powernow.c b/sys/x86/cpufreq/powernow.c --- a/sys/x86/cpufreq/powernow.c +++ b/sys/x86/cpufreq/powernow.c @@ -870,7 +870,7 @@ default: return; } - if (device_find_child(parent, "powernow", -1) != NULL) + if (device_find_child(parent, "powernow", DEVICE_UNIT_ANY) != NULL) return; if (BUS_ADD_CHILD(parent, 10, "powernow", device_get_unit(parent)) == NULL) @@ -944,7 +944,8 @@ int rv; device_t child; - child = device_find_child(device_get_parent(dev), "acpi_perf", -1); + child = device_find_child(device_get_parent(dev), "acpi_perf", + DEVICE_UNIT_ANY); if (child) { rv = pn_decode_acpi(dev, child); if (rv) diff --git a/sys/x86/cpufreq/smist.c b/sys/x86/cpufreq/smist.c --- a/sys/x86/cpufreq/smist.c +++ b/sys/x86/cpufreq/smist.c @@ -305,7 +305,7 @@ if (bootverbose) printf("smist: found supported isa bridge %s\n", id->desc); - if (device_find_child(parent, "smist", -1) != NULL) + if (device_find_child(parent, "smist", DEVICE_UNIT_ANY) != NULL) return; if (BUS_ADD_CHILD(parent, 30, "smist", device_get_unit(parent)) == NULL) @@ -330,13 +330,15 @@ * If the ACPI perf or ICH SpeedStep drivers have attached and not * just offering info, let them manage things. */ - perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1); + perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", + DEVICE_UNIT_ANY); if (perf_dev && device_is_attached(perf_dev)) { rv = CPUFREQ_DRV_TYPE(perf_dev, &type); if (rv == 0 && (type & CPUFREQ_FLAG_INFO_ONLY) == 0) return (ENXIO); } - ichss_dev = device_find_child(device_get_parent(dev), "ichss", -1); + ichss_dev = device_find_child(device_get_parent(dev), "ichss", + DEVICE_UNIT_ANY); if (ichss_dev && device_is_attached(ichss_dev)) return (ENXIO); diff --git a/sys/x86/pci/qpi.c b/sys/x86/pci/qpi.c --- a/sys/x86/pci/qpi.c +++ b/sys/x86/pci/qpi.c @@ -80,7 +80,7 @@ return; /* Add a qpi bus device. */ - if (BUS_ADD_CHILD(parent, 20, "qpi", -1) == NULL) + if (BUS_ADD_CHILD(parent, 20, "qpi", DEVICE_UNIT_ANY) == NULL) panic("Failed to add qpi bus"); }