newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANY

Sponsored by:		Netflix
This commit is contained in:
Warner Losh 2024-07-24 22:23:02 -06:00
parent 5b56413d04
commit a05a680469
44 changed files with 49 additions and 49 deletions

View File

@ -385,7 +385,7 @@ max77620_rtc_create(struct max77620_softc *sc, phandle_t node)
parent = device_get_parent(sc->dev);
child = BUS_ADD_CHILD(parent, 0, NULL, -1);
child = BUS_ADD_CHILD(parent, 0, NULL, DEVICE_UNIT_ANY);
if (child == NULL) {
device_printf(sc->dev, "Cannot create MAX77620 RTC device.\n");
return (ENXIO);

View File

@ -57,7 +57,7 @@ ossl_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, "ossl", -1) == NULL)
BUS_ADD_CHILD(parent, 10, "ossl", -1);
BUS_ADD_CHILD(parent, 10, "ossl", DEVICE_UNIT_ANY);
}
static int

View File

@ -2396,7 +2396,7 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status)
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "scanning '%s'\n", handle_str));
order = level * 10 + ACPI_DEV_BASE_ORDER;
acpi_probe_order(handle, &order);
child = BUS_ADD_CHILD(bus, order, NULL, -1);
child = BUS_ADD_CHILD(bus, order, NULL, DEVICE_UNIT_ANY);
if (child == NULL)
break;

View File

@ -271,7 +271,7 @@ amdsbwd_identify(driver_t *driver, device_t parent)
pci_get_devid(smb_dev) != HYGONCZ_SMBUS_DEVID)
return;
child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "amdsbwd", -1);
child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "amdsbwd", DEVICE_UNIT_ANY);
if (child == NULL)
device_printf(parent, "add amdsbwd child failed\n");
}

View File

@ -678,7 +678,7 @@ bcma_add_children(device_t bus)
bcma_erom = (struct bcma_erom *)erom;
while ((error = bcma_erom_next_corecfg(bcma_erom, &corecfg)) == 0) {
/* Add the child device */
child = BUS_ADD_CHILD(bus, 0, NULL, -1);
child = BUS_ADD_CHILD(bus, 0, NULL, DEVICE_UNIT_ANY);
if (child == NULL) {
error = ENXIO;
goto cleanup;

View File

@ -558,7 +558,7 @@ bhndb_attach(device_t dev, struct bhnd_chipid *cid,
}
/* Add our bridged bus device */
sc->bus_dev = BUS_ADD_CHILD(dev, BHND_PROBE_BUS, "bhnd", -1);
sc->bus_dev = BUS_ADD_CHILD(dev, BHND_PROBE_BUS, "bhnd", DEVICE_UNIT_ANY);
if (sc->bus_dev == NULL) {
error = ENXIO;
goto failed;

View File

@ -270,7 +270,7 @@ chipc_add_children(struct chipc_softc *sc)
if (sc->caps.nvram_src == BHND_NVRAM_SRC_SPROM ||
sc->caps.nvram_src == BHND_NVRAM_SRC_OTP)
{
child = BUS_ADD_CHILD(sc->dev, 0, "bhnd_nvram", -1);
child = BUS_ADD_CHILD(sc->dev, 0, "bhnd_nvram", DEVICE_UNIT_ANY);
if (child == NULL) {
device_printf(sc->dev, "failed to add nvram device\n");
return (ENXIO);
@ -293,13 +293,13 @@ chipc_add_children(struct chipc_softc *sc)
* attached directly to the bhnd(4) bus -- not chipc.
*/
if (sc->caps.pmu && !sc->caps.aob) {
child = BUS_ADD_CHILD(sc->dev, 0, "bhnd_pmu", -1);
child = BUS_ADD_CHILD(sc->dev, 0, "bhnd_pmu", DEVICE_UNIT_ANY);
if (child == NULL) {
device_printf(sc->dev, "failed to add pmu\n");
return (ENXIO);
}
} else if (sc->caps.pwr_ctrl) {
child = BUS_ADD_CHILD(sc->dev, 0, "bhnd_pwrctl", -1);
child = BUS_ADD_CHILD(sc->dev, 0, "bhnd_pwrctl", DEVICE_UNIT_ANY);
if (child == NULL) {
device_printf(sc->dev, "failed to add pwrctl\n");
return (ENXIO);
@ -307,7 +307,7 @@ chipc_add_children(struct chipc_softc *sc)
}
/* GPIO */
child = BUS_ADD_CHILD(sc->dev, 0, "gpio", -1);
child = BUS_ADD_CHILD(sc->dev, 0, "gpio", DEVICE_UNIT_ANY);
if (child == NULL) {
device_printf(sc->dev, "failed to add gpio\n");
return (ENXIO);
@ -331,7 +331,7 @@ chipc_add_children(struct chipc_softc *sc)
irq_rid = 0;
mem_rid = 0;
child = BUS_ADD_CHILD(sc->dev, 0, "uart", -1);
child = BUS_ADD_CHILD(sc->dev, 0, "uart", DEVICE_UNIT_ANY);
if (child == NULL) {
device_printf(sc->dev, "failed to add uart%u\n", i);
return (ENXIO);
@ -360,7 +360,7 @@ chipc_add_children(struct chipc_softc *sc)
if (flash_bus != NULL) {
int rid;
child = BUS_ADD_CHILD(sc->dev, 0, flash_bus, -1);
child = BUS_ADD_CHILD(sc->dev, 0, flash_bus, DEVICE_UNIT_ANY);
if (child == NULL) {
device_printf(sc->dev, "failed to add %s device\n",
flash_bus);

View File

@ -122,7 +122,7 @@ chipc_spi_attach(device_t dev)
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, -1);
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;

View File

@ -1318,7 +1318,7 @@ siba_add_children(device_t dev)
goto failed;
/* Add the child device */
child = BUS_ADD_CHILD(dev, 0, NULL, -1);
child = BUS_ADD_CHILD(dev, 0, NULL, DEVICE_UNIT_ANY);
if (child == NULL) {
error = ENXIO;
goto failed;

View File

@ -81,7 +81,7 @@ cferes_identify(driver_t* driver, device_t parent)
struct cferes_softc *sc;
uint64_t addr, len, type;
child = BUS_ADD_CHILD(parent, 100, "cferes", -1);
child = BUS_ADD_CHILD(parent, 100, "cferes", DEVICE_UNIT_ANY);
device_set_driver(child, driver);
sc = device_get_softc(child);

View File

@ -74,7 +74,7 @@ chromebook_i2c_identify(driver_t *driver, device_t bus)
continue;
if (slaves[i].pci_id != pci_get_devid(controller))
continue;
child = BUS_ADD_CHILD(bus, 0, slaves[i].name, -1);
child = BUS_ADD_CHILD(bus, 0, slaves[i].name, DEVICE_UNIT_ANY);
if (child != NULL)
iicbus_set_addr(child, slaves[i].addr);
}

View File

@ -205,7 +205,7 @@ e6000sw_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, "e6000sw", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "e6000sw", -1);
BUS_ADD_CHILD(parent, 0, "e6000sw", DEVICE_UNIT_ANY);
}
static int

View File

@ -83,7 +83,7 @@ static void
etherswitch_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, "etherswitch", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "etherswitch", -1);
BUS_ADD_CHILD(parent, 0, "etherswitch", DEVICE_UNIT_ANY);
}
static int

View File

@ -84,7 +84,7 @@ static void
ip17x_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, "ip17x", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "ip17x", -1);
BUS_ADD_CHILD(parent, 0, "ip17x", DEVICE_UNIT_ANY);
}
static int

View File

@ -331,7 +331,7 @@ static void
mdioproxy_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, driver->name, -1) == NULL) {
BUS_ADD_CHILD(parent, 0, driver->name, -1);
BUS_ADD_CHILD(parent, 0, driver->name, DEVICE_UNIT_ANY);
}
}

View File

@ -134,7 +134,7 @@ rtl8366rb_identify(driver_t *driver, device_t parent)
struct iicbus_ivar *devi;
if (device_find_child(parent, "rtl8366rb", -1) == NULL) {
child = BUS_ADD_CHILD(parent, 0, "rtl8366rb", -1);
child = BUS_ADD_CHILD(parent, 0, "rtl8366rb", DEVICE_UNIT_ANY);
devi = IICBUS_IVAR(child);
devi->addr = RTL8366_IIC_ADDR;
}

View File

@ -314,7 +314,7 @@ fw_asystart(struct fw_xfer *xfer)
static void
firewire_identify(driver_t *driver, device_t parent)
{
BUS_ADD_CHILD(parent, 0, "firewire", -1);
BUS_ADD_CHILD(parent, 0, "firewire", DEVICE_UNIT_ANY);
}
static int

View File

@ -304,7 +304,7 @@ SBP_DEBUG(0)
END_DEBUG
if (device_find_child(parent, "sbp", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "sbp", -1);
BUS_ADD_CHILD(parent, 0, "sbp", DEVICE_UNIT_ANY);
}
/*

View File

@ -226,7 +226,7 @@ hidbus_enumerate_children(device_t dev, const void* data, hid_size_t len)
while (hid_get_item(hd, &hi)) {
if (hi.kind != hid_collection || hi.collevel != 1)
continue;
child = BUS_ADD_CHILD(dev, 0, NULL, -1);
child = BUS_ADD_CHILD(dev, 0, NULL, DEVICE_UNIT_ANY);
if (child == NULL) {
device_printf(dev, "Could not add HID device\n");
continue;

View File

@ -512,7 +512,7 @@ acpi_iicbus_enumerate_child(ACPI_HANDLE handle, UINT32 level,
return (AE_OK);
}
child = BUS_ADD_CHILD(iicbus, 0, NULL, -1);
child = BUS_ADD_CHILD(iicbus, 0, NULL, DEVICE_UNIT_ANY);
if (child == NULL) {
device_printf(iicbus, "add child failed\n");
return (AE_OK);

View File

@ -134,7 +134,7 @@ iic_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, "iic", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "iic", -1);
BUS_ADD_CHILD(parent, 0, "iic", DEVICE_UNIT_ANY);
}
static int

View File

@ -135,7 +135,7 @@ iicsmb_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, "iicsmb", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "iicsmb", -1);
BUS_ADD_CHILD(parent, 0, "iicsmb", DEVICE_UNIT_ANY);
}
static int

View File

@ -70,7 +70,7 @@ ipmi_isa_identify(driver_t *driver, device_t parent)
if (devid != 0xffffffff &&
ipmi_pci_match(devid & 0xffff, devid >> 16) != NULL)
return;
BUS_ADD_CHILD(parent, 0, "ipmi", -1);
BUS_ADD_CHILD(parent, 0, "ipmi", DEVICE_UNIT_ANY);
}
}

View File

@ -60,7 +60,7 @@ ipmi_smbus_identify(driver_t *driver, device_t parent)
if (ipmi_smbios_identify(&info) && info.iface_type == SSIF_MODE &&
device_find_child(parent, "ipmi", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "ipmi", -1);
BUS_ADD_CHILD(parent, 0, "ipmi", DEVICE_UNIT_ANY);
}
static int

View File

@ -157,7 +157,7 @@ isl_identify(driver_t *driver, device_t parent)
/* Check if we can communicate to our slave. */
if (init_device(dev, 0x88, 1) == 0)
BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "isl", -1);
BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "isl", DEVICE_UNIT_ANY);
}
#endif

View File

@ -38,7 +38,7 @@ mdio_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, mdio_driver.name, -1) == NULL)
BUS_ADD_CHILD(parent, 0, mdio_driver.name, -1);
BUS_ADD_CHILD(parent, 0, mdio_driver.name, DEVICE_UNIT_ANY);
}
static int

View File

@ -109,7 +109,7 @@ nvdimm_root_create_devs(device_t dev, ACPI_TABLE_NFIT *nfitbl)
if (dimm_handle == NULL)
continue;
child = BUS_ADD_CHILD(dev, 100, "nvdimm", -1);
child = BUS_ADD_CHILD(dev, 100, "nvdimm", DEVICE_UNIT_ANY);
if (child == NULL) {
device_printf(dev, "failed to create nvdimm\n");
return (ENXIO);

View File

@ -275,7 +275,7 @@ nvdimm_e820_identify(driver_t *driver, device_t parent)
if (smapbase == NULL)
return;
child = BUS_ADD_CHILD(parent, 0, driver->name, -1);
child = BUS_ADD_CHILD(parent, 0, driver->name, DEVICE_UNIT_ANY);
if (child == NULL)
device_printf(parent, "add %s child failed\n", driver->name);
}

View File

@ -216,7 +216,7 @@ lp_identify(driver_t *driver, device_t parent)
dev = device_find_child(parent, "plip", -1);
if (!dev)
BUS_ADD_CHILD(parent, 0, "plip", -1);
BUS_ADD_CHILD(parent, 0, "plip", DEVICE_UNIT_ANY);
}
static int

View File

@ -63,7 +63,7 @@ lpbb_identify(driver_t *driver, device_t parent)
dev = device_find_child(parent, "lpbb", -1);
if (!dev)
BUS_ADD_CHILD(parent, 0, "lpbb", -1);
BUS_ADD_CHILD(parent, 0, "lpbb", DEVICE_UNIT_ANY);
}
static int

View File

@ -339,7 +339,7 @@ lpt_identify(driver_t *driver, device_t parent)
dev = device_find_child(parent, LPT_NAME, -1);
if (!dev)
BUS_ADD_CHILD(parent, 0, LPT_NAME, -1);
BUS_ADD_CHILD(parent, 0, LPT_NAME, DEVICE_UNIT_ANY);
}
/*

View File

@ -113,7 +113,7 @@ pcfclock_identify(driver_t *driver, device_t parent)
dev = device_find_child(parent, PCFCLOCK_NAME, -1);
if (!dev)
BUS_ADD_CHILD(parent, 0, PCFCLOCK_NAME, -1);
BUS_ADD_CHILD(parent, 0, PCFCLOCK_NAME, DEVICE_UNIT_ANY);
}
static int

View File

@ -137,7 +137,7 @@ ppi_identify(driver_t *driver, device_t parent)
dev = device_find_child(parent, "ppi", -1);
if (!dev)
BUS_ADD_CHILD(parent, 0, "ppi", -1);
BUS_ADD_CHILD(parent, 0, "ppi", DEVICE_UNIT_ANY);
}
/*

View File

@ -78,7 +78,7 @@ ppsidentify(driver_t *driver, device_t parent)
dev = device_find_child(parent, PPS_NAME, -1);
if (!dev)
BUS_ADD_CHILD(parent, 0, PPS_NAME, -1);
BUS_ADD_CHILD(parent, 0, PPS_NAME, DEVICE_UNIT_ANY);
}
static int

View File

@ -145,7 +145,7 @@ smbios_identify (driver_t *driver, device_t parent)
}
}
child = BUS_ADD_CHILD(parent, 5, "smbios", -1);
child = BUS_ADD_CHILD(parent, 5, "smbios", DEVICE_UNIT_ANY);
device_set_driver(child, driver);
/* smuggle the phys addr into probe and attach */

View File

@ -127,7 +127,7 @@ smb_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, "smb", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "smb", -1);
BUS_ADD_CHILD(parent, 0, "smb", DEVICE_UNIT_ANY);
}
static int

View File

@ -685,7 +685,7 @@ superio_add_known_child(device_t dev, superio_dev_type_t type, uint8_t ldn)
struct superio_devinfo *dinfo;
device_t child;
child = BUS_ADD_CHILD(dev, 0, NULL, -1);
child = BUS_ADD_CHILD(dev, 0, NULL, DEVICE_UNIT_ANY);
if (child == NULL) {
device_printf(dev, "failed to add child for ldn %d, type %s\n",
ldn, devtype_to_str(type));

View File

@ -151,7 +151,7 @@ smapi_identify (driver_t *driver, device_t parent)
rid = 0;
length = ADDR2HDR(addr)->length;
child = BUS_ADD_CHILD(parent, 5, "smapi", -1);
child = BUS_ADD_CHILD(parent, 5, "smapi", DEVICE_UNIT_ANY);
device_set_driver(child, driver);
bus_set_resource(child, SYS_RES_MEMORY, rid, addr, length);
device_set_desc(child, "SMAPI BIOS");

View File

@ -642,7 +642,7 @@ pnpbios_identify(driver_t *driver, device_t parent)
continue;
/* Add the device and parse its resources */
dev = BUS_ADD_CHILD(parent, ISA_ORDER_PNPBIOS, NULL, -1);
dev = BUS_ADD_CHILD(parent, ISA_ORDER_PNPBIOS, NULL, DEVICE_UNIT_ANY);
isa_set_vendorid(dev, pd->devid);
isa_set_logicalid(dev, pd->devid);
/*

View File

@ -469,7 +469,7 @@ pnp_create_devices(device_t parent, pnp_id *p, int csn,
*/
bcopy(resinfo, &logical_id, 4);
pnp_check_quirks(p->vendor_id, logical_id, ldn, NULL);
dev = BUS_ADD_CHILD(parent, ISA_ORDER_PNP, NULL, -1);
dev = BUS_ADD_CHILD(parent, ISA_ORDER_PNP, NULL, DEVICE_UNIT_ANY);
if (desc)
device_set_desc_copy(dev, desc);
else

View File

@ -145,7 +145,7 @@ atpic_isa_identify(driver_t *drv, device_t parent)
{
device_t child;
child = BUS_ADD_CHILD(parent, ISA_ORDER_SENSITIVE, drv->name, -1);
child = BUS_ADD_CHILD(parent, ISA_ORDER_SENSITIVE, drv->name, DEVICE_UNIT_ANY);
device_set_driver(child, drv);
isa_set_logicalid(child, atpic_ids[0].ip_id);
isa_set_vendorid(child, atpic_ids[0].ip_id);

View File

@ -141,7 +141,7 @@ vpd_identify (driver_t *driver, device_t parent)
rid = 0;
length = ADDR2VPD(addr)->Length;
child = BUS_ADD_CHILD(parent, 5, "vpd", -1);
child = BUS_ADD_CHILD(parent, 5, "vpd", DEVICE_UNIT_ANY);
device_set_driver(child, driver);
bus_set_resource(child, SYS_RES_MEMORY, rid, addr, length);
device_set_desc(child, "Vital Product Data Area");

View File

@ -94,7 +94,7 @@ orm_identify(driver_t* driver, device_t parent)
if (resource_disabled("orm", 0))
return;
child = BUS_ADD_CHILD(parent, ISA_ORDER_SENSITIVE, "orm", -1);
child = BUS_ADD_CHILD(parent, ISA_ORDER_SENSITIVE, "orm", DEVICE_UNIT_ANY);
device_set_driver(child, driver);
isa_set_logicalid(child, ORM_ID);
isa_set_vendorid(child, ORM_ID);

View File

@ -132,7 +132,7 @@ qpi_probe_pcib(device_t dev, int bus)
return (ENXIO);
}
child = BUS_ADD_CHILD(dev, 0, "pcib", -1);
child = BUS_ADD_CHILD(dev, 0, "pcib", DEVICE_UNIT_ANY);
if (child == NULL)
panic("%s: failed to add pci bus %d", device_get_nameunit(dev),
bus);