aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/smbus/smbus.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/smbus/smbus.c')
-rw-r--r--sys/dev/smbus/smbus.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/smbus/smbus.c b/sys/dev/smbus/smbus.c
index eed1aa6efce0..9a37c482654b 100644
--- a/sys/dev/smbus/smbus.c
+++ b/sys/dev/smbus/smbus.c
@@ -67,9 +67,9 @@ smbus_attach(device_t dev)
struct smbus_softc *sc = device_get_softc(dev);
mtx_init(&sc->lock, device_get_nameunit(dev), "smbus", MTX_DEF);
- bus_generic_probe(dev);
+ bus_identify_children(dev);
bus_enumerate_hinted_children(dev);
- bus_generic_attach(dev);
+ bus_attach_children(dev);
return (0);
}
@@ -83,7 +83,6 @@ smbus_detach(device_t dev)
error = bus_generic_detach(dev);
if (error)
return (error);
- device_delete_children(dev);
mtx_destroy(&sc->lock);
return (0);
@@ -113,6 +112,12 @@ smbus_add_child(device_t dev, u_int order, const char *name, int unit)
}
static void
+smbus_child_deleted(device_t dev, device_t child)
+{
+ free(device_get_ivars(child), M_DEVBUF);
+}
+
+static void
smbus_hinted_child(device_t bus, const char *dname, int dunit)
{
struct smbus_ivar *devi;
@@ -222,6 +227,7 @@ static device_method_t smbus_methods[] = {
/* bus interface */
DEVMETHOD(bus_add_child, smbus_add_child),
+ DEVMETHOD(bus_child_deleted, smbus_child_deleted),
DEVMETHOD(bus_hinted_child, smbus_hinted_child),
DEVMETHOD(bus_probe_nomatch, smbus_probe_nomatch),
DEVMETHOD(bus_child_location, smbus_child_location),