From owner-p4-projects@FreeBSD.ORG Wed Mar 29 22:25:26 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4264216A453; Wed, 29 Mar 2006 22:25:26 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1B9B016A430 for ; Wed, 29 Mar 2006 22:25:26 +0000 (UTC) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 126B843D73 for ; Wed, 29 Mar 2006 22:25:19 +0000 (GMT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k2TMPIMK078406 for ; Wed, 29 Mar 2006 22:25:18 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2TMPIiH078403 for perforce@freebsd.org; Wed, 29 Mar 2006 22:25:18 GMT (envelope-from marcel@freebsd.org) Date: Wed, 29 Mar 2006 22:25:18 GMT Message-Id: <200603292225.k2TMPIiH078403@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Cc: Subject: PERFORCE change 94268 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Mar 2006 22:25:26 -0000 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