aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/iicbus/controller/twsi/twsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/iicbus/controller/twsi/twsi.c')
-rw-r--r--sys/dev/iicbus/controller/twsi/twsi.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/dev/iicbus/controller/twsi/twsi.c b/sys/dev/iicbus/controller/twsi/twsi.c
index 55d12b6ee5ae..46704e1eab65 100644
--- a/sys/dev/iicbus/controller/twsi/twsi.c
+++ b/sys/dev/iicbus/controller/twsi/twsi.c
@@ -812,12 +812,13 @@ twsi_attach(device_t dev)
&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);
}
- bus_generic_attach(dev);
+ bus_attach_children(dev);
config_intrhook_oneshot(twsi_intr_start, dev);
@@ -835,10 +836,6 @@ twsi_detach(device_t dev)
if ((rv = bus_generic_detach(dev)) != 0)
return (rv);
- if (sc->iicbus != NULL)
- if ((rv = device_delete_child(dev, sc->iicbus)) != 0)
- return (rv);
-
if (sc->intrhand != NULL)
bus_teardown_intr(sc->dev, sc->res[1], sc->intrhand);