PERFORCE change 95523 for review
Marcel Moolenaar
marcel at FreeBSD.org
Tue Apr 18 20:27:56 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=95523
Change 95523 by marcel at marcel_nfs on 2006/04/18 20:26:48
o Implement puc_bfe_detach().
Affected files ...
.. //depot/projects/uart/dev/puc/puc.c#28 edit
Differences ...
==== //depot/projects/uart/dev/puc/puc.c#28 (text+ko) ====
@@ -290,7 +290,46 @@
int
puc_bfe_detach(device_t dev)
{
- return (ENXIO);
+ struct puc_bar *bar;
+ struct puc_port *port;
+ struct puc_softc *sc;
+ int error, idx;
+
+ sc = device_get_softc(dev);
+
+ /* Detach our children. */
+ error = 0;
+ for (idx = 0; idx < sc->sc_nports; idx++) {
+ port = &sc->sc_port[idx];
+ if (port->p_dev == NULL)
+ continue;
+ if (device_detach(port->p_dev) == 0) {
+ device_delete_child(dev, port->p_dev);
+ if (port->p_rres != NULL)
+ rman_release_resource(port->p_rres);
+ if (port->p_ires != NULL)
+ rman_release_resource(port->p_ires);
+ } else
+ error = ENXIO;
+ }
+ if (error)
+ return (error);
+
+ bus_teardown_intr(dev, sc->sc_ires, sc->sc_icookie);
+ bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irid, sc->sc_ires);
+
+ for (idx = 0; idx < PUC_PCI_BARS; idx++) {
+ bar = &sc->sc_bar[idx];
+ if (bar->b_res != NULL)
+ bus_release_resource(sc->sc_dev, bar->b_type,
+ bar->b_rid, bar->b_res);
+ }
+
+ rman_fini(&sc->sc_irq);
+ rman_fini(&sc->sc_iomem);
+ rman_fini(&sc->sc_ioport);
+ free(sc->sc_port, M_PUC);
+ return (0);
}
int
More information about the p4-projects
mailing list