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
This commit is contained in:
Brian Somers 2005-07-29 00:20:50 +00:00
parent 76efe32555
commit fa6e2680c0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148497
2 changed files with 3 additions and 8 deletions

View File

@ -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
}

View File

@ -233,4 +233,3 @@ ichsmb_pci_attach(device_t dev)
MODULE_DEPEND(ichsmb, pci, 1, 1, 1);
MODULE_DEPEND(ichsmb, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER);
MODULE_VERSION(ichsmb, 1);
;