diff options
Diffstat (limited to 'sys/dev/bhnd/cores/chipc')
-rw-r--r-- | sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c | 4 | ||||
-rw-r--r-- | sys/dev/bhnd/cores/chipc/chipc.c | 26 | ||||
-rw-r--r-- | sys/dev/bhnd/cores/chipc/chipc_spi.c | 9 |
3 files changed, 18 insertions, 21 deletions
diff --git a/sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c b/sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c index 95b19d973e26..ce50fcd0ee1f 100644 --- a/sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c +++ b/sys/dev/bhnd/cores/chipc/bhnd_pmu_chipc.c @@ -62,7 +62,6 @@ bhnd_pmu_chipc_probe(device_t dev) struct chipc_caps *ccaps; struct chipc_softc *chipc_sc; device_t chipc; - char desc[34]; int error; uint32_t pcaps; uint8_t rev; @@ -87,8 +86,7 @@ bhnd_pmu_chipc_probe(device_t dev) /* Set description */ rev = BHND_PMU_GET_BITS(pcaps, BHND_PMU_CAP_REV); - snprintf(desc, sizeof(desc), "Broadcom ChipCommon PMU, rev %hhu", rev); - device_set_desc_copy(dev, desc); + device_set_descf(dev, "Broadcom ChipCommon PMU, rev %hhu", rev); return (BUS_PROBE_NOWILDCARD); } diff --git a/sys/dev/bhnd/cores/chipc/chipc.c b/sys/dev/bhnd/cores/chipc/chipc.c index 60cb04400cb0..24697a8f0b17 100644 --- a/sys/dev/bhnd/cores/chipc/chipc.c +++ b/sys/dev/bhnd/cores/chipc/chipc.c @@ -211,13 +211,12 @@ chipc_attach(device_t dev) * response to ChipCommin API requests. * * Since our children may need access to ChipCommon, this must be done - * before attaching our children below (via bus_generic_attach). + * before attaching our children below (via bus_attach_children). */ if ((error = bhnd_register_provider(dev, BHND_SERVICE_CHIPC))) goto failed; - if ((error = bus_generic_attach(dev))) - goto failed; + bus_attach_children(dev); return (0); @@ -245,9 +244,6 @@ chipc_detach(device_t dev) if ((error = bus_generic_detach(dev))) return (error); - if ((error = device_delete_children(dev))) - return (error); - if ((error = bhnd_deregister_provider(dev, BHND_SERVICE_ANY))) return (error); @@ -270,7 +266,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 +289,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 +303,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 +327,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 +356,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); @@ -894,6 +890,10 @@ chipc_release_resource(device_t dev, device_t child, struct resource *r) if (cr == NULL) return (EINVAL); + /* Cache rle */ + rle = resource_list_find(BUS_GET_RESOURCE_LIST(dev, child), + rman_get_type(r), rman_get_rid(r)); + /* Deactivate resources */ error = bus_generic_rman_release_resource(dev, child, r); if (error != 0) @@ -903,8 +903,6 @@ chipc_release_resource(device_t dev, device_t child, struct resource *r) chipc_release_region(sc, cr, RF_ALLOCATED); /* Clear reference from the resource list entry if exists */ - rle = resource_list_find(BUS_GET_RESOURCE_LIST(dev, child), - rman_get_type(r), rman_get_rid(r)); if (rle != NULL) rle->res = NULL; diff --git a/sys/dev/bhnd/cores/chipc/chipc_spi.c b/sys/dev/bhnd/cores/chipc/chipc_spi.c index 75e4b5cb7bc4..290933e5ef25 100644 --- a/sys/dev/bhnd/cores/chipc/chipc_spi.c +++ b/sys/dev/bhnd/cores/chipc/chipc_spi.c @@ -107,7 +107,8 @@ chipc_spi_attach(device_t dev) * 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; @@ -115,14 +116,14 @@ chipc_spi_attach(device_t dev) /* Let spibus perform full attach before we try to call * BUS_ADD_CHILD() */ - if ((error = bus_generic_attach(dev))) - goto failed; + bus_attach_children(dev); /* Determine flash type and add the flash child */ 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; |