diff options
Diffstat (limited to 'sys/dev/glxiic/glxiic.c')
-rw-r--r-- | sys/dev/glxiic/glxiic.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/dev/glxiic/glxiic.c b/sys/dev/glxiic/glxiic.c index 16ed337c543b..ef0a0e111339 100644 --- a/sys/dev/glxiic/glxiic.c +++ b/sys/dev/glxiic/glxiic.c @@ -284,11 +284,11 @@ glxiic_identify(driver_t *driver, device_t parent) { /* Prevent child from being added more than once. */ - if (device_find_child(parent, driver->name, -1) != NULL) + if (device_find_child(parent, driver->name, DEVICE_UNIT_ANY) != NULL) return; if (pci_get_devid(parent) == GLXIIC_CS5536_DEV_ID) { - if (device_add_child(parent, driver->name, -1) == NULL) + if (device_add_child(parent, driver->name, DEVICE_UNIT_ANY) == NULL) device_printf(parent, "Could not add glxiic child\n"); } } @@ -390,7 +390,8 @@ glxiic_attach(device_t dev) goto out; } - 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"); error = ENXIO; goto out; @@ -408,7 +409,7 @@ glxiic_attach(device_t dev) glxiic_smb_enable(sc, IIC_FASTEST, 0); /* Probe and attach the iicbus when interrupts are available. */ - error = bus_delayed_attach_children(dev); + bus_delayed_attach_children(dev); out: if (error != 0) { @@ -451,11 +452,8 @@ glxiic_detach(device_t dev) error = bus_generic_detach(dev); if (error != 0) - goto out; - if (sc->iicbus != NULL) - error = device_delete_child(dev, sc->iicbus); + return (error); -out: callout_drain(&sc->callout); if (sc->smb_res != NULL) { @@ -479,7 +477,7 @@ out: GLXIIC_LOCK_DESTROY(sc); - return (error); + return (0); } static uint8_t |