diff options
Diffstat (limited to 'sys/dev/smbus')
-rw-r--r-- | sys/dev/smbus/smb.c | 4 | ||||
-rw-r--r-- | sys/dev/smbus/smbconf.h | 2 | ||||
-rw-r--r-- | sys/dev/smbus/smbus.c | 12 |
3 files changed, 12 insertions, 6 deletions
diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c index ee323c835f10..514c42b88131 100644 --- a/sys/dev/smbus/smb.c +++ b/sys/dev/smbus/smb.c @@ -126,8 +126,8 @@ static void smb_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "smb", -1) == NULL) - BUS_ADD_CHILD(parent, 0, "smb", -1); + if (device_find_child(parent, "smb", DEVICE_UNIT_ANY) == NULL) + BUS_ADD_CHILD(parent, 0, "smb", DEVICE_UNIT_ANY); } static int diff --git a/sys/dev/smbus/smbconf.h b/sys/dev/smbus/smbconf.h index 4c646df20a30..a6c320594064 100644 --- a/sys/dev/smbus/smbconf.h +++ b/sys/dev/smbus/smbconf.h @@ -30,7 +30,7 @@ #include <sys/queue.h> -#define SMBPRI (PZERO+8) /* XXX sleep/wakeup queue priority */ +#define SMBPRI (PWAIT) /* XXX sleep/wakeup queue priority */ #define n(flags) (~(flags) & (flags)) 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), |