From 8b3f56edd4c08f7f3a58c0db13f53d43c10c1bc0 Mon Sep 17 00:00:00 2001 From: brian Date: Fri, 29 Jul 2005 00:20:50 +0000 Subject: Make ichsmb unloadable. It seems that the unload problems were due to a dodgy sc->smb usage and a missing mtx_destroy(). Sponsored by: ActiveState/Sophos MFC after: 3 weeks --- sys/dev/ichsmb/ichsmb.c | 10 +++------- sys/dev/ichsmb/ichsmb_pci.c | 1 - 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'sys/dev/ichsmb') diff --git a/sys/dev/ichsmb/ichsmb.c b/sys/dev/ichsmb/ichsmb.c index 2cfb564..9361c7e 100644 --- a/sys/dev/ichsmb/ichsmb.c +++ b/sys/dev/ichsmb/ichsmb.c @@ -108,10 +108,9 @@ 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) { + if ((sc->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); @@ -677,15 +676,12 @@ ichsmb_release_resources(sc_p sc) int ichsmb_detach(device_t dev) { -#if 0 const sc_p sc = device_get_softc(dev); + + mtx_destroy(&sc->mutex); 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 } diff --git a/sys/dev/ichsmb/ichsmb_pci.c b/sys/dev/ichsmb/ichsmb_pci.c index 41f7c29..54c3b97 100644 --- a/sys/dev/ichsmb/ichsmb_pci.c +++ b/sys/dev/ichsmb/ichsmb_pci.c @@ -233,4 +233,3 @@ fail: MODULE_DEPEND(ichsmb, pci, 1, 1, 1); MODULE_DEPEND(ichsmb, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER); MODULE_VERSION(ichsmb, 1); -; -- cgit v1.1