Skip to content

Commit 454c532

Browse files
paliLorenzo Pieralisi
authored andcommitted
PCI: aardvark: Simplify initialization of rootcap on virtual bridge
PCIe config space can be initialized also before pci_bridge_emul_init() call, so move rootcap initialization after PCI config space initialization. This simplifies the function a little since it removes one if (ret < 0) check. Link: https://lore.kernel.org/r/20211005180952.6812-11-kabel@kernel.org Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Reviewed-by: Marek Behún <kabel@kernel.org>
1 parent 223dec1 commit 454c532

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

‎drivers/pci/controller/pci-aardvark.c‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,6 @@ static struct pci_bridge_emul_ops advk_pci_bridge_emul_ops = {
822822
static int advk_sw_pci_bridge_init(struct advk_pcie *pcie)
823823
{
824824
struct pci_bridge_emul *bridge = &pcie->bridge;
825-
int ret;
826825

827826
bridge->conf.vendor =
828827
cpu_to_le16(advk_readl(pcie, PCIE_CORE_DEV_ID_REG) & 0xffff);
@@ -842,19 +841,14 @@ static int advk_sw_pci_bridge_init(struct advk_pcie *pcie)
842841
/* Support interrupt A for MSI feature */
843842
bridge->conf.intpin = PCIE_CORE_INT_A_ASSERT_ENABLE;
844843

844+
/* Indicates supports for Completion Retry Status */
845+
bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS);
846+
845847
bridge->has_pcie = true;
846848
bridge->data = pcie;
847849
bridge->ops = &advk_pci_bridge_emul_ops;
848850

849-
/* PCIe config space can be initialized after pci_bridge_emul_init() */
850-
ret = pci_bridge_emul_init(bridge, 0);
851-
if (ret < 0)
852-
return ret;
853-
854-
/* Indicates supports for Completion Retry Status */
855-
bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS);
856-
857-
return 0;
851+
return pci_bridge_emul_init(bridge, 0);
858852
}
859853

860854
static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus,

0 commit comments

Comments
 (0)