Date: Wed, 29 Mar 2006 22:25:18 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 94268 for review Message-ID: <200603292225.k2TMPIiH078403@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=94268 Change 94268 by marcel@marcel_nfs on 2006/03/29 22:24:25 Implement scc_bfe_detach(). Affected files ... .. //depot/projects/uart/dev/scc/scc_core.c#14 edit Differences ... ==== //depot/projects/uart/dev/scc/scc_core.c#14 (text+ko) ==== @@ -271,8 +271,44 @@ int scc_bfe_detach(device_t dev) { + struct scc_chan *ch; + struct scc_class *cl; + struct scc_mode *m; + struct scc_softc *sc; + int chan, error, mode; + + sc = device_get_softc(dev); + cl = sc->sc_class; + + /* Detach our children. */ + error = 0; + for (chan = 0; chan < cl->cl_channels; chan++) { + ch = &sc->sc_chan[chan]; + for (mode = 0; mode < SCC_NMODES; mode++) { + m = &ch->ch_mode[mode]; + if (!m->m_attached) + continue; + if (device_detach(m->m_dev) != 0) + error = ENXIO; + else + m->m_attached = 0; + } + } + + if (error) + return (error); - return (ENXIO); + if (sc->sc_ires != NULL) { + bus_teardown_intr(dev, sc->sc_ires, sc->sc_icookie); + bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irid, + sc->sc_ires); + } + bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres); + + free(sc->sc_chan, M_SCC); + + mtx_destroy(&sc->sc_hwmtx); + return (0); } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603292225.k2TMPIiH078403>