public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci: j721e: fix host/endpoint dependencies
@ 2025-04-23 16:25 Arnd Bergmann
  2025-04-24  5:19 ` Siddharth Vadapalli
  2025-04-27 16:26 ` Manivannan Sadhasivam
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2025-04-23 16:25 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Bjorn Helgaas, Vignesh Raghavendra
  Cc: Arnd Bergmann, Rob Herring, Siddharth Vadapalli,
	Kishon Vijay Abraham I, Thomas Richard, Théo Lebrun,
	Sergio Paracuellos, linux-pci, linux-kernel, linux-omap,
	linux-arm-kernel

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
 drivers/pci/controller/cadence/Kconfig     | 4 ++--
 drivers/pci/controller/cadence/pci-j721e.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/cadence/Kconfig b/drivers/pci/controller/cadence/Kconfig
index 72d7d264d6c3..666e16b6367f 100644
--- a/drivers/pci/controller/cadence/Kconfig
+++ b/drivers/pci/controller/cadence/Kconfig
@@ -44,12 +44,13 @@ config PCIE_CADENCE_PLAT_EP
 
 config PCI_J721E
 	tristate
+	select PCIE_CADENCE_HOST if PCI_J721E_HOST != n
+	select PCIE_CADENCE_EP if PCI_J721E_EP != n
 
 config PCI_J721E_HOST
 	tristate "TI J721E PCIe controller (host mode)"
 	depends on ARCH_K3 || COMPILE_TEST
 	depends on OF
-	select PCIE_CADENCE_HOST
 	select PCI_J721E
 	help
 	  Say Y here if you want to support the TI J721E PCIe platform
@@ -61,7 +62,6 @@ config PCI_J721E_EP
 	depends on ARCH_K3 || COMPILE_TEST
 	depends on OF
 	depends on PCI_ENDPOINT
-	select PCIE_CADENCE_EP
 	select PCI_J721E
 	help
 	  Say Y here if you want to support the TI J721E PCIe platform
diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
index b87bc26bbf06..f0051805f9e9 100644
--- a/drivers/pci/controller/cadence/pci-j721e.c
+++ b/drivers/pci/controller/cadence/pci-j721e.c
@@ -475,7 +475,7 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 
 	switch (mode) {
 	case PCI_MODE_RC:
-		if (!IS_ENABLED(CONFIG_PCIE_CADENCE_HOST))
+		if (!IS_ENABLED(CONFIG_PCI_J721E_HOST))
 			return -ENODEV;
 
 		bridge = devm_pci_alloc_host_bridge(dev, sizeof(*rc));
@@ -494,7 +494,7 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 		pcie->cdns_pcie = cdns_pcie;
 		break;
 	case PCI_MODE_EP:
-		if (!IS_ENABLED(CONFIG_PCIE_CADENCE_EP))
+		if (!IS_ENABLED(CONFIG_PCI_J721E_EP))
 			return -ENODEV;
 
 		ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pci: j721e: fix host/endpoint dependencies
  2025-04-23 16:25 [PATCH] pci: j721e: fix host/endpoint dependencies Arnd Bergmann
@ 2025-04-24  5:19 ` Siddharth Vadapalli
  2025-04-27 16:26 ` Manivannan Sadhasivam
  1 sibling, 0 replies; 3+ messages in thread
From: Siddharth Vadapalli @ 2025-04-24  5:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Bjorn Helgaas, Vignesh Raghavendra,
	Arnd Bergmann, Rob Herring, Siddharth Vadapalli,
	Kishon Vijay Abraham I, Thomas Richard, Théo Lebrun,
	Sergio Paracuellos, linux-pci, linux-kernel, linux-omap,
	linux-arm-kernel

On Wed, Apr 23, 2025 at 06:25:16PM +0200, Arnd Bergmann wrote:

Hello Arnd,

Thank you for the Fix.

> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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 <arnd@arndb.de>

Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>

Regards,
Siddharth.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pci: j721e: fix host/endpoint dependencies
  2025-04-23 16:25 [PATCH] pci: j721e: fix host/endpoint dependencies Arnd Bergmann
  2025-04-24  5:19 ` Siddharth Vadapalli
@ 2025-04-27 16:26 ` Manivannan Sadhasivam
  1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2025-04-27 16:26 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Krzysztof Wilczyński, Bjorn Helgaas,
	Vignesh Raghavendra, Arnd Bergmann
  Cc: Manivannan Sadhasivam, Arnd Bergmann, Rob Herring,
	Siddharth Vadapalli, Kishon Vijay Abraham I, Thomas Richard,
	Théo Lebrun, Sergio Paracuellos, linux-pci, linux-kernel,
	linux-omap, linux-arm-kernel


On Wed, 23 Apr 2025 18:25:16 +0200, Arnd Bergmann wrote:
> 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:
> 
> [...]

Applied, thanks!

[1/1] pci: j721e: fix host/endpoint dependencies
      commit: 10aae64c2fb5148409cc9beba7f849a79fe82f17

Best regards,
-- 
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-27 16:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-23 16:25 [PATCH] pci: j721e: fix host/endpoint dependencies Arnd Bergmann
2025-04-24  5:19 ` Siddharth Vadapalli
2025-04-27 16:26 ` Manivannan Sadhasivam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox