diff options
author | ru <ru@FreeBSD.org> | 2005-12-20 21:06:57 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-12-20 21:06:57 +0000 |
commit | 72e61e2d3bec15609be575225502065a46ed18ac (patch) | |
tree | 63c40024864f0330e96733e1aa960dffd1194aa5 /sys/dev/smbus | |
parent | 6e683e52b7ce974a4e839da2a42c3ce22eeba98b (diff) | |
download | FreeBSD-src-72e61e2d3bec15609be575225502065a46ed18ac.zip FreeBSD-src-72e61e2d3bec15609be575225502065a46ed18ac.tar.gz |
Create "smb" device when "smbus" device is attached, so that it's
possible to load/unload smb.ko and smbus-implementing driver in
any order, and get expected results.
Diffstat (limited to 'sys/dev/smbus')
-rw-r--r-- | sys/dev/smbus/smb.c | 10 | ||||
-rw-r--r-- | sys/dev/smbus/smbus.c | 12 |
2 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c index 8073cc5..ca4fbe6 100644 --- a/sys/dev/smbus/smb.c +++ b/sys/dev/smbus/smb.c @@ -58,13 +58,11 @@ struct smb_softc { static int smb_probe(device_t); static int smb_attach(device_t); static int smb_detach(device_t); -static void smb_identify(driver_t *driver, device_t parent); static devclass_t smb_devclass; static device_method_t smb_methods[] = { /* device interface */ - DEVMETHOD(device_identify, smb_identify), DEVMETHOD(device_probe, smb_probe), DEVMETHOD(device_attach, smb_attach), DEVMETHOD(device_detach, smb_detach), @@ -94,14 +92,6 @@ static struct cdevsw smb_cdevsw = { .d_name = "smb", }; -static void -smb_identify(driver_t *driver, device_t parent) -{ - - if (!device_find_child(parent, "smb", -1)) - device_add_child(parent, "smb", -1); -} - static int smb_probe(device_t dev) { diff --git a/sys/dev/smbus/smbus.c b/sys/dev/smbus/smbus.c index d8c0a76..6429a7a 100644 --- a/sys/dev/smbus/smbus.c +++ b/sys/dev/smbus/smbus.c @@ -49,11 +49,12 @@ static devclass_t smbus_devclass; * Device methods */ static int smbus_probe(device_t); +static int smbus_attach(device_t); static device_method_t smbus_methods[] = { /* device interface */ DEVMETHOD(device_probe, smbus_probe), - DEVMETHOD(device_attach, bus_generic_attach), + DEVMETHOD(device_attach, smbus_attach), DEVMETHOD(device_detach, bus_generic_detach), /* bus interface */ @@ -81,6 +82,15 @@ smbus_probe(device_t dev) return (0); } +static int +smbus_attach(device_t dev) +{ + device_add_child(dev, NULL, -1); + bus_generic_attach(dev); + + return (0); +} + void smbus_generic_intr(device_t dev, u_char devaddr, char low, char high) { |