diff options
author | takawata <takawata@FreeBSD.org> | 2005-06-10 16:12:43 +0000 |
---|---|---|
committer | takawata <takawata@FreeBSD.org> | 2005-06-10 16:12:43 +0000 |
commit | 024ebcc52b509051395cceb59fa99050e956b50c (patch) | |
tree | 2cd076dd2fc7197365fd6d324bae56838d28caab /sys/dev/ichsmb/ichsmb.c | |
parent | 6ee6d8891675b656ba92d6c73aa98b03a975c2fe (diff) | |
download | FreeBSD-src-024ebcc52b509051395cceb59fa99050e956b50c.zip FreeBSD-src-024ebcc52b509051395cceb59fa99050e956b50c.tar.gz |
Make ichsmb(4) child device handling properly.
Diffstat (limited to 'sys/dev/ichsmb/ichsmb.c')
-rw-r--r-- | sys/dev/ichsmb/ichsmb.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/sys/dev/ichsmb/ichsmb.c b/sys/dev/ichsmb/ichsmb.c index aed9396..2cfb564 100644 --- a/sys/dev/ichsmb/ichsmb.c +++ b/sys/dev/ichsmb/ichsmb.c @@ -96,14 +96,6 @@ static int ichsmb_wait(sc_p sc); int ichsmb_probe(device_t dev) { - device_t smb; - - /* Add child: an instance of the "smbus" device */ - if ((smb = device_add_child(dev, DRIVER_SMBUS, -1)) == NULL) { - log(LOG_ERR, "%s: no \"%s\" child found\n", - device_get_nameunit(dev), DRIVER_SMBUS); - return (ENXIO); - } return (BUS_PROBE_DEFAULT); } @@ -116,6 +108,14 @@ ichsmb_attach(device_t dev) { const sc_p sc = device_get_softc(dev); int error; + device_t smb; + + /* Add child: an instance of the "smbus" device */ + if ((smb = device_add_child(dev, DRIVER_SMBUS, -1)) == NULL) { + log(LOG_ERR, "%s: no \"%s\" child found\n", + device_get_nameunit(dev), DRIVER_SMBUS); + return (ENXIO); + } /* Clear interrupt conditions */ bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_STA, 0xff); @@ -675,3 +675,17 @@ ichsmb_release_resources(sc_p sc) } } +int ichsmb_detach(device_t dev) +{ +#if 0 + const sc_p sc = device_get_softc(dev); + bus_generic_detach(dev); + device_delete_child(dev, sc->smb); + ichsmb_release_resources(sc); + + return 0; +#else + /*smbus drivers don't handle detach child properly*/ + return EBUSY; +#endif +} |