Skip to content

Commit 49169c2

Browse files
robherringLorenzo Pieralisi
authored andcommitted
PCI: xilinx: 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 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]> Cc: [email protected] Cc: [email protected]
1 parent 77fc9aa commit 49169c2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/pci/controller/pcie-xilinx.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
* @reg_base: IO Mapped Register Base
9999
* @irq: Interrupt number
100100
* @msi_pages: MSI pages
101-
* @root_busno: Root Bus number
102101
* @dev: Device pointer
103102
* @msi_domain: MSI IRQ domain pointer
104103
* @leg_domain: Legacy IRQ domain pointer
@@ -108,7 +107,6 @@ struct xilinx_pcie_port {
108107
void __iomem *reg_base;
109108
u32 irq;
110109
unsigned long msi_pages;
111-
u8 root_busno;
112110
struct device *dev;
113111
struct irq_domain *msi_domain;
114112
struct irq_domain *leg_domain;
@@ -162,14 +160,13 @@ static bool xilinx_pcie_valid_device(struct pci_bus *bus, unsigned int devfn)
162160
struct xilinx_pcie_port *port = bus->sysdata;
163161

164162
/* Check if link is up when trying to access downstream ports */
165-
if (bus->number != port->root_busno)
163+
if (!pci_is_root_bus(bus)) {
166164
if (!xilinx_pcie_link_up(port))
167165
return false;
168-
169-
/* Only one device down on each root port */
170-
if (bus->number == port->root_busno && devfn > 0)
166+
} else if (devfn > 0) {
167+
/* Only one device down on each root port */
171168
return false;
172-
169+
}
173170
return true;
174171
}
175172

0 commit comments

Comments
 (0)