Skip to content

Commit 388637d

Browse files
robherringLorenzo Pieralisi
authored andcommitted
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/[email protected] Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Cc: Karthikeyan Mitran <[email protected]> Cc: Hou Zhiqiang <[email protected]> Cc: Lorenzo Pieralisi <[email protected]> Cc: Bjorn Helgaas <[email protected]>
1 parent 5525493 commit 388637d

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

drivers/pci/controller/mobiveil/pcie-mobiveil-host.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,15 @@
2929

3030
static bool mobiveil_pcie_valid_device(struct pci_bus *bus, unsigned int devfn)
3131
{
32-
struct mobiveil_pcie *pcie = bus->sysdata;
33-
struct mobiveil_root_port *rp = &pcie->rp;
34-
3532
/* Only one device down on each root port */
36-
if ((bus->number == rp->root_bus_nr) && (devfn > 0))
33+
if (pci_is_root_bus(bus) && (devfn > 0))
3734
return false;
3835

3936
/*
4037
* Do not read more than one device on the bus directly
4138
* attached to RC
4239
*/
43-
if ((bus->primary == rp->root_bus_nr) && (PCI_SLOT(devfn) > 0))
40+
if ((bus->primary == to_pci_host_bridge(bus->bridge)->busnr) && (PCI_SLOT(devfn) > 0))
4441
return false;
4542

4643
return true;
@@ -61,7 +58,7 @@ static void __iomem *mobiveil_pcie_map_bus(struct pci_bus *bus,
6158
return NULL;
6259

6360
/* RC config access */
64-
if (bus->number == rp->root_bus_nr)
61+
if (pci_is_root_bus(bus))
6562
return pcie->csr_axi_slave_base + where;
6663

6764
/*
@@ -606,7 +603,6 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
606603

607604
/* Initialize bridge */
608605
bridge->sysdata = pcie;
609-
bridge->busnr = rp->root_bus_nr;
610606
bridge->ops = &mobiveil_pcie_ops;
611607
bridge->map_irq = of_irq_parse_and_map_pci;
612608
bridge->swizzle_irq = pci_common_swizzle;

drivers/pci/controller/mobiveil/pcie-mobiveil.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ struct mobiveil_rp_ops {
149149
};
150150

151151
struct mobiveil_root_port {
152-
char root_bus_nr;
153152
void __iomem *config_axi_slave_base; /* endpoint config base */
154153
struct resource *ob_io_res;
155154
struct mobiveil_rp_ops *ops;

0 commit comments

Comments
 (0)