static bool mobiveil_pcie_valid_device(struct pci_bus *bus, unsigned int devfn)
 {
-       struct mobiveil_pcie *pcie = bus->sysdata;
-       struct mobiveil_root_port *rp = &pcie->rp;
-
        /* Only one device down on each root port */
-       if ((bus->number == rp->root_bus_nr) && (devfn > 0))
+       if (pci_is_root_bus(bus) && (devfn > 0))
                return false;
 
        /*
         * Do not read more than one device on the bus directly
         * attached to RC
         */
-       if ((bus->primary == rp->root_bus_nr) && (PCI_SLOT(devfn) > 0))
+       if ((bus->primary == to_pci_host_bridge(bus->bridge)->busnr) && (PCI_SLOT(devfn) > 0))
                return false;
 
        return true;
                return NULL;
 
        /* RC config access */
-       if (bus->number == rp->root_bus_nr)
+       if (pci_is_root_bus(bus))
                return pcie->csr_axi_slave_base + where;
 
        /*
 
        /* Initialize bridge */
        bridge->sysdata = pcie;
-       bridge->busnr = rp->root_bus_nr;
        bridge->ops = &mobiveil_pcie_ops;
        bridge->map_irq = of_irq_parse_and_map_pci;
        bridge->swizzle_irq = pci_common_swizzle;