mirror of https://gitee.com/openkylin/linux.git
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/20200722022514.1283916-9-robh@kernel.org Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: linux-pci@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org
This commit is contained in:
parent
77fc9aa969
commit
49169c255c
|
@ -98,7 +98,6 @@
|
||||||
* @reg_base: IO Mapped Register Base
|
* @reg_base: IO Mapped Register Base
|
||||||
* @irq: Interrupt number
|
* @irq: Interrupt number
|
||||||
* @msi_pages: MSI pages
|
* @msi_pages: MSI pages
|
||||||
* @root_busno: Root Bus number
|
|
||||||
* @dev: Device pointer
|
* @dev: Device pointer
|
||||||
* @msi_domain: MSI IRQ domain pointer
|
* @msi_domain: MSI IRQ domain pointer
|
||||||
* @leg_domain: Legacy IRQ domain pointer
|
* @leg_domain: Legacy IRQ domain pointer
|
||||||
|
@ -108,7 +107,6 @@ struct xilinx_pcie_port {
|
||||||
void __iomem *reg_base;
|
void __iomem *reg_base;
|
||||||
u32 irq;
|
u32 irq;
|
||||||
unsigned long msi_pages;
|
unsigned long msi_pages;
|
||||||
u8 root_busno;
|
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct irq_domain *msi_domain;
|
struct irq_domain *msi_domain;
|
||||||
struct irq_domain *leg_domain;
|
struct irq_domain *leg_domain;
|
||||||
|
@ -162,14 +160,13 @@ static bool xilinx_pcie_valid_device(struct pci_bus *bus, unsigned int devfn)
|
||||||
struct xilinx_pcie_port *port = bus->sysdata;
|
struct xilinx_pcie_port *port = bus->sysdata;
|
||||||
|
|
||||||
/* Check if link is up when trying to access downstream ports */
|
/* Check if link is up when trying to access downstream ports */
|
||||||
if (bus->number != port->root_busno)
|
if (!pci_is_root_bus(bus)) {
|
||||||
if (!xilinx_pcie_link_up(port))
|
if (!xilinx_pcie_link_up(port))
|
||||||
return false;
|
return false;
|
||||||
|
} else if (devfn > 0) {
|
||||||
/* Only one device down on each root port */
|
/* Only one device down on each root port */
|
||||||
if (bus->number == port->root_busno && devfn > 0)
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue