MFS rev 1.8.2.8:

release resources on detach

Submitted by:	"Christopher N . Harrell" <cnh@netvmg.com>
This commit is contained in:
Cameron Grant 2001-08-27 00:54:26 +00:00
parent 63fa9f4c0d
commit 52eb6afd0c

View File

@ -333,11 +333,31 @@ csa_attach(device_t dev)
static int
csa_detach(device_t dev)
{
csa_res *resp;
sc_p scp;
int err;
scp = device_get_softc(dev);
device_delete_child(dev, scp->midi);
device_delete_child(dev, scp->pcm);
resp = &scp->res;
err = 0;
if (scp->midi != NULL)
err = device_delete_child(dev, scp->midi);
if (err)
return err;
scp->midi = NULL;
if (scp->pcm != NULL)
err = device_delete_child(dev, scp->pcm);
if (err)
return err;
scp->pcm = NULL;
bus_teardown_intr(dev, resp->irq, scp->ih);
bus_release_resource(dev, SYS_RES_IRQ, resp->irq_rid, resp->irq);
bus_release_resource(dev, SYS_RES_MEMORY, resp->mem_rid, resp->mem);
bus_release_resource(dev, SYS_RES_MEMORY, resp->io_rid, resp->io);
return bus_generic_detach(dev);
}