Date: Sat, 3 Mar 2012 17:26:15 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 207315 for review Message-ID: <201203031726.q23HQFLE000222@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@207315?ac=10 Change 207315 by jhb@jhb_fiver on 2012/03/03 17:25:29 Make this simpler and remove the 'tag_valid' member from the PCI bus softc by having the tag always be valid and just cache the parent tag if we don't create one. Affected files ... .. //depot/projects/pci/sys/dev/pci/pci.c#32 edit .. //depot/projects/pci/sys/dev/pci/pci_private.h#9 edit Differences ... ==== //depot/projects/pci/sys/dev/pci/pci.c#32 (text+ko) ==== @@ -3155,7 +3155,7 @@ pci_attach_common(device_t dev) { struct pci_softc *sc; - int busno, domain, error; + int busno, domain, error, tag_valid; #ifdef PCI_RES_BUS int rid; #endif @@ -3175,6 +3175,7 @@ if (bootverbose) device_printf(dev, "domain=%d, physical bus=%d\n", domain, busno); + tag_valid = 0; if (device_get_devclass(device_get_parent(device_get_parent(dev))) != devclass_find("pci")) { error = bus_dma_tag_create(bus_get_dma_tag(dev), 1, @@ -3185,8 +3186,10 @@ device_printf(dev, "Failed to create DMA tag: %d\n", error); else - sc->sc_dma_tag_valid = 1; + tag_valid = 1; } + if (!tag_valid) + sc->sc_dma_tag = bus_get_dma_tag(dev); return (0); } @@ -4313,9 +4316,7 @@ { struct pci_softc *sc = device_get_softc(bus); - if (sc->sc_dma_tag_valid) - return (sc->sc_dma_tag); - return (bus_generic_get_dma_tag(bus, dev)); + return (sc->sc_dma_tag); } uint32_t ==== //depot/projects/pci/sys/dev/pci/pci_private.h#9 (text+ko) ==== @@ -40,7 +40,6 @@ struct pci_softc { bus_dma_tag_t sc_dma_tag; - int sc_dma_tag_valid; #ifdef PCI_RES_BUS struct resource *sc_bus; #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203031726.q23HQFLE000222>