diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -950,12 +950,9 @@ const struct devnames *names; /* PCIe register resources */ - int regs_rid; struct resource *regs_res; - int msix_rid; struct resource *msix_res; bus_size_t mmio_len; - int udbs_rid; struct resource *udbs_res; volatile uint8_t *udbs_base; diff --git a/sys/dev/cxgbe/t4_iov.c b/sys/dev/cxgbe/t4_iov.c --- a/sys/dev/cxgbe/t4_iov.c +++ b/sys/dev/cxgbe/t4_iov.c @@ -52,7 +52,6 @@ bool sc_attached; int pf; - int regs_rid; struct resource *regs_res; }; @@ -240,15 +239,15 @@ { struct t4iov_softc *sc; uint32_t pl_rev, whoami; - int error; + int error, rid; uint8_t f; sc = device_get_softc(dev); sc->sc_dev = dev; - sc->regs_rid = PCIR_BAR(0); + rid = PCIR_BAR(0); sc->regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->regs_rid, RF_ACTIVE); + &rid, RF_ACTIVE); if (sc->regs_res == NULL) { device_printf(dev, "cannot map registers.\n"); return (ENXIO); @@ -266,15 +265,13 @@ sc->sc_main = pci_find_dbsf(pci_get_domain(dev), pci_get_bus(dev), pci_get_slot(dev), f); if (sc->sc_main == NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, sc->regs_rid, - sc->regs_res); + bus_release_resource(dev, sc->regs_res); return (ENXIO); } if (T4_IS_MAIN_READY(sc->sc_main) == 0) { error = t4iov_attach_child(dev); if (error != 0) - bus_release_resource(dev, SYS_RES_MEMORY, sc->regs_rid, - sc->regs_res); + bus_release_resource(dev, sc->regs_res); return (error); } return (0); @@ -357,8 +354,7 @@ return (error); } if (sc->regs_res) { - bus_release_resource(dev, SYS_RES_MEMORY, sc->regs_rid, - sc->regs_res); + bus_release_resource(dev, sc->regs_res); } return (0); } diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -1983,16 +1983,13 @@ pci_release_msi(dev); if (sc->regs_res) - bus_release_resource(dev, SYS_RES_MEMORY, sc->regs_rid, - sc->regs_res); + bus_release_resource(dev, sc->regs_res); if (sc->udbs_res) - bus_release_resource(dev, SYS_RES_MEMORY, sc->udbs_rid, - sc->udbs_res); + bus_release_resource(dev, sc->udbs_res); if (sc->msix_res) - bus_release_resource(dev, SYS_RES_MEMORY, sc->msix_rid, - sc->msix_res); + bus_release_resource(dev, sc->msix_res); if (sc->l2t) t4_free_l2t(sc); @@ -4060,9 +4057,11 @@ int t4_map_bars_0_and_4(struct adapter *sc) { - sc->regs_rid = PCIR_BAR(0); + int rid; + + rid = PCIR_BAR(0); sc->regs_res = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, - &sc->regs_rid, RF_ACTIVE); + &rid, RF_ACTIVE); if (sc->regs_res == NULL) { device_printf(sc->dev, "cannot map registers.\n"); return (ENXIO); @@ -4070,9 +4069,9 @@ sc->mmio_len = rman_get_size(sc->regs_res); setbit(&sc->doorbells, DOORBELL_KDB); - sc->msix_rid = PCIR_BAR(4); + rid = PCIR_BAR(4); sc->msix_res = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, - &sc->msix_rid, RF_ACTIVE); + &rid, RF_ACTIVE); if (sc->msix_res == NULL) { device_printf(sc->dev, "cannot map MSI-X BAR.\n"); return (ENXIO); @@ -4084,6 +4083,7 @@ int t4_map_bar_2(struct adapter *sc) { + int rid; /* * T4: only iWARP driver uses the userspace doorbells. There is no need @@ -4092,9 +4092,9 @@ if (is_t4(sc) && sc->rdmacaps == 0) return (0); - sc->udbs_rid = PCIR_BAR(2); + rid = PCIR_BAR(2); sc->udbs_res = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, - &sc->udbs_rid, RF_ACTIVE); + &rid, RF_ACTIVE); if (sc->udbs_res == NULL) { device_printf(sc->dev, "cannot map doorbell BAR.\n"); return (ENXIO);