Skip to content

Commit 77fc9aa

Browse files
robherringLorenzo Pieralisi
authored andcommitted
PCI: xilinx-nwl: 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. There was also a bug that the pci_host_bridge.busnr is set from root_busno, but root_busno is never set which means the root bus number is always 0 even if the DT said something else. 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: Lorenzo Pieralisi <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Michal Simek <[email protected]>
1 parent 388637d commit 77fc9aa

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

drivers/pci/controller/pcie-xilinx-nwl.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ struct nwl_pcie {
166166
int irq_misc;
167167
u32 ecam_value;
168168
u8 last_busno;
169-
u8 root_busno;
170169
struct nwl_msi msi;
171170
struct irq_domain *legacy_irq_domain;
172171
raw_spinlock_t leg_mask_lock;
@@ -217,13 +216,11 @@ static bool nwl_pcie_valid_device(struct pci_bus *bus, unsigned int devfn)
217216
struct nwl_pcie *pcie = bus->sysdata;
218217

219218
/* Check link before accessing downstream ports */
220-
if (bus->number != pcie->root_busno) {
219+
if (!pci_is_root_bus(bus)) {
221220
if (!nwl_pcie_link_up(pcie))
222221
return false;
223-
}
224-
225-
/* Only one device down on each root port */
226-
if (bus->number == pcie->root_busno && devfn > 0)
222+
} else if (devfn > 0)
223+
/* Only one device down on each root port */
227224
return false;
228225

229226
return true;
@@ -855,7 +852,6 @@ static int nwl_pcie_probe(struct platform_device *pdev)
855852
}
856853

857854
bridge->sysdata = pcie;
858-
bridge->busnr = pcie->root_busno;
859855
bridge->ops = &nwl_pcie_ops;
860856
bridge->map_irq = of_irq_parse_and_map_pci;
861857
bridge->swizzle_irq = pci_common_swizzle;

0 commit comments

Comments
 (0)