diff options
Diffstat (limited to 'sys/dev/iicbus/controller/vybrid/vf_i2c.c')
-rw-r--r-- | sys/dev/iicbus/controller/vybrid/vf_i2c.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/sys/dev/iicbus/controller/vybrid/vf_i2c.c b/sys/dev/iicbus/controller/vybrid/vf_i2c.c index d3c3664af78c..4735a95cf5cd 100644 --- a/sys/dev/iicbus/controller/vybrid/vf_i2c.c +++ b/sys/dev/iicbus/controller/vybrid/vf_i2c.c @@ -184,7 +184,7 @@ vf_i2c_attach_common(device_t dev) mtx_unlock(&sc->mutex); - 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"); @@ -193,7 +193,7 @@ vf_i2c_attach_common(device_t dev) return (ENXIO); } - bus_generic_attach(dev); + bus_attach_children(dev); return (0); } @@ -207,23 +207,17 @@ i2c_detach(device_t dev) sc = device_get_softc(dev); vf_i2c_dbg(sc, "i2c detach\n"); - mtx_lock(&sc->mutex); - - if (sc->freq == 0) { - vf_i2c_dbg(sc, "Writing 0x00 to clock divider register\n"); - WRITE1(sc, I2C_IBFD, 0x00); - } - error = bus_generic_detach(dev); if (error != 0) { device_printf(dev, "cannot detach child devices.\n"); return (error); } - error = device_delete_child(dev, sc->iicbus); - if (error != 0) { - device_printf(dev, "could not delete iicbus child.\n"); - return (error); + mtx_lock(&sc->mutex); + + if (sc->freq == 0) { + vf_i2c_dbg(sc, "Writing 0x00 to clock divider register\n"); + WRITE1(sc, I2C_IBFD, 0x00); } bus_release_resources(dev, i2c_spec, sc->res); |