Skip to content

Commit 3c05e88

Browse files
arndbbjorn-helgaas
authored andcommitted
PCI: j721e: Fix host/endpoint dependencies
The j721e driver has a single platform driver that can be built-in or a loadable module, but it calls two separate backend drivers depending on whether it is a host or endpoint. If the two modes are not the same, we can end up with a situation where the built-in pci-j721e driver tries to call the modular host or endpoint driver, which causes a link failure: ld.lld-21: error: undefined symbol: cdns_pcie_ep_setup >>> referenced by pci-j721e.c >>> drivers/pci/controller/cadence/pci-j721e.o:(j721e_pcie_probe) in archive vmlinux.a ld.lld-21: error: undefined symbol: cdns_pcie_host_setup >>> referenced by pci-j721e.c >>> drivers/pci/controller/cadence/pci-j721e.o:(j721e_pcie_probe) in archive vmlinux.a Rework the dependencies so that the 'select' is done by the common Kconfig symbol, based on which of the two are enabled. Effectively this means that having one built-in makes the other either built-in or disabled, but all configurations will now build. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Siddharth Vadapalli <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent a2790bf commit 3c05e88

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/pci/controller/cadence/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ config PCIE_CADENCE_PLAT_EP
4444

4545
config PCI_J721E
4646
tristate
47+
select PCIE_CADENCE_HOST if PCI_J721E_HOST != n
48+
select PCIE_CADENCE_EP if PCI_J721E_EP != n
4749

4850
config PCI_J721E_HOST
4951
tristate "TI J721E PCIe controller (host mode)"
5052
depends on ARCH_K3 || COMPILE_TEST
5153
depends on OF
52-
select PCIE_CADENCE_HOST
5354
select PCI_J721E
5455
help
5556
Say Y here if you want to support the TI J721E PCIe platform
@@ -61,7 +62,6 @@ config PCI_J721E_EP
6162
depends on ARCH_K3 || COMPILE_TEST
6263
depends on OF
6364
depends on PCI_ENDPOINT
64-
select PCIE_CADENCE_EP
6565
select PCI_J721E
6666
help
6767
Say Y here if you want to support the TI J721E PCIe platform

drivers/pci/controller/cadence/pci-j721e.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ static int j721e_pcie_probe(struct platform_device *pdev)
475475

476476
switch (mode) {
477477
case PCI_MODE_RC:
478-
if (!IS_ENABLED(CONFIG_PCIE_CADENCE_HOST))
478+
if (!IS_ENABLED(CONFIG_PCI_J721E_HOST))
479479
return -ENODEV;
480480

481481
bridge = devm_pci_alloc_host_bridge(dev, sizeof(*rc));
@@ -494,7 +494,7 @@ static int j721e_pcie_probe(struct platform_device *pdev)
494494
pcie->cdns_pcie = cdns_pcie;
495495
break;
496496
case PCI_MODE_EP:
497-
if (!IS_ENABLED(CONFIG_PCIE_CADENCE_EP))
497+
if (!IS_ENABLED(CONFIG_PCI_J721E_EP))
498498
return -ENODEV;
499499

500500
ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL);

0 commit comments

Comments
 (0)