1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Actually release resources in detach() rather than just returning EBUSY.

This will enable use of 'devctl disable', allow creation of a module, etc.
This commit is contained in:
Ian Lepore 2017-10-27 17:21:43 +00:00
parent cef5abd140
commit ab8e311b11
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325045

View File

@ -803,9 +803,26 @@ fsl_sdhci_get_platform_clock(device_t dev)
static int
fsl_sdhci_detach(device_t dev)
{
struct fsl_sdhci_softc *sc = device_get_softc(dev);
/* sdhci_fdt_gpio_teardown(sc->gpio); */
return (EBUSY);
if (sc->gpio != NULL)
sdhci_fdt_gpio_teardown(sc->gpio);
callout_drain(&sc->r1bfix_callout);
if (sc->intr_cookie != NULL)
bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie);
if (sc->irq_res != NULL)
bus_release_resource(dev, SYS_RES_IRQ,
rman_get_rid(sc->irq_res), sc->irq_res);
if (sc->mem_res != NULL) {
sdhci_cleanup_slot(&sc->slot);
bus_release_resource(dev, SYS_RES_MEMORY,
rman_get_rid(sc->mem_res), sc->mem_res);
}
return (0);
}
static int
@ -918,13 +935,7 @@ fsl_sdhci_attach(device_t dev)
return (0);
fail:
if (sc->intr_cookie)
bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie);
if (sc->irq_res)
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res);
if (sc->mem_res)
bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res);
fsl_sdhci_detach(dev);
return (err);
}
@ -932,7 +943,7 @@ static int
fsl_sdhci_probe(device_t dev)
{
if (!ofw_bus_status_okay(dev))
if (!ofw_bus_status_okay(dev))
return (ENXIO);
switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) {