Author: ian Date: Sat Feb 17 23:39:10 2018 New Revision: 329480 URL: https://svnweb.freebsd.org/changeset/base/329480
Log: Don't call sdhci_cleanup_slot() if sdhci_init_slot() never got called. Also, do callout_init() very early in attach, so that callout_drain() can be called in detach without worrying about whether it ever got init'd. Modified: head/sys/dev/sdhci/fsl_sdhci.c Modified: head/sys/dev/sdhci/fsl_sdhci.c ============================================================================== --- head/sys/dev/sdhci/fsl_sdhci.c Sat Feb 17 23:23:27 2018 (r329479) +++ head/sys/dev/sdhci/fsl_sdhci.c Sat Feb 17 23:39:10 2018 (r329480) @@ -92,6 +92,7 @@ struct fsl_sdhci_softc { uint16_t sdclockreg_freq_bits; uint8_t r1bfix_type; uint8_t hwtype; + bool slot_init_done; }; #define R1BFIX_NONE 0 /* No fix needed at next interrupt. */ @@ -810,6 +811,9 @@ fsl_sdhci_detach(device_t dev) callout_drain(&sc->r1bfix_callout); + if (sc->slot_init_done) + sdhci_cleanup_slot(&sc->slot); + if (sc->intr_cookie != NULL) bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie); if (sc->irq_res != NULL) @@ -817,7 +821,6 @@ fsl_sdhci_detach(device_t dev) 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); } @@ -837,6 +840,8 @@ fsl_sdhci_attach(device_t dev) sc->dev = dev; + callout_init(&sc->r1bfix_callout, 1); + sc->hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; if (sc->hwtype == HWTYPE_NONE) panic("Impossible: not compatible in fsl_sdhci_attach()"); @@ -924,8 +929,8 @@ fsl_sdhci_attach(device_t dev) WR4(sc, SDHC_PROT_CTRL, protctl); #endif - callout_init(&sc->r1bfix_callout, 1); sdhci_init_slot(dev, &sc->slot, 0); + sc->slot_init_done = true; bus_generic_probe(dev); bus_generic_attach(dev); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"