提交 388637d9 编写于 作者: R Rob Herring 提交者: Lorenzo Pieralisi

PCI: mobiveil: Use pci_is_root_bus() to check if bus is root bus

Use pci_is_root_bus() rather than tracking the root bus number to
determine if the bus is the root bus or not. This removes storing
duplicated data as well as the need for the host bridge driver to have
to care about the bus numbers in most cases.

Link: https://lore.kernel.org/r/20200722022514.1283916-7-robh@kernel.orgSigned-off-by: NRob Herring <robh@kernel.org>
Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: NBjorn Helgaas <bhelgaas@google.com>
Cc: Karthikeyan Mitran <m.karthikeyan@mobiveil.co.in>
Cc: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
上级 55254938
...@@ -29,18 +29,15 @@ ...@@ -29,18 +29,15 @@
static bool mobiveil_pcie_valid_device(struct pci_bus *bus, unsigned int devfn) 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 */ /* 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; return false;
/* /*
* Do not read more than one device on the bus directly * Do not read more than one device on the bus directly
* attached to RC * 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 false;
return true; return true;
...@@ -61,7 +58,7 @@ static void __iomem *mobiveil_pcie_map_bus(struct pci_bus *bus, ...@@ -61,7 +58,7 @@ static void __iomem *mobiveil_pcie_map_bus(struct pci_bus *bus,
return NULL; return NULL;
/* RC config access */ /* RC config access */
if (bus->number == rp->root_bus_nr) if (pci_is_root_bus(bus))
return pcie->csr_axi_slave_base + where; return pcie->csr_axi_slave_base + where;
/* /*
...@@ -606,7 +603,6 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie) ...@@ -606,7 +603,6 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
/* Initialize bridge */ /* Initialize bridge */
bridge->sysdata = pcie; bridge->sysdata = pcie;
bridge->busnr = rp->root_bus_nr;
bridge->ops = &mobiveil_pcie_ops; bridge->ops = &mobiveil_pcie_ops;
bridge->map_irq = of_irq_parse_and_map_pci; bridge->map_irq = of_irq_parse_and_map_pci;
bridge->swizzle_irq = pci_common_swizzle; bridge->swizzle_irq = pci_common_swizzle;
......
...@@ -149,7 +149,6 @@ struct mobiveil_rp_ops { ...@@ -149,7 +149,6 @@ struct mobiveil_rp_ops {
}; };
struct mobiveil_root_port { struct mobiveil_root_port {
char root_bus_nr;
void __iomem *config_axi_slave_base; /* endpoint config base */ void __iomem *config_axi_slave_base; /* endpoint config base */
struct resource *ob_io_res; struct resource *ob_io_res;
struct mobiveil_rp_ops *ops; struct mobiveil_rp_ops *ops;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册