On Fri, 2025-11-14 at 08:03 +0100, Arnd Bergmann wrote:
On Fri, Nov 14, 2025, at 06:47, Siddharth Vadapalli wrote:
On Thu, 2025-11-13 at 11:13 +0100, Arnd Bergmann wrote:
On Thu, Nov 13, 2025, at 10:27, Siddharth Vadapalli wrote:
Thank you for the suggestion. I think that the following Makefile changes will be sufficient and Kconfig doesn't need to be modified:
diff --git a/drivers/pci/controller/cadence/Makefile b/drivers/pci/controller/cadence/Makefile index 5e23f8539ecc..1a97c9b249b8 100644 --- a/drivers/pci/controller/cadence/Makefile +++ b/drivers/pci/controller/cadence/Makefile @@ -4,4 +4,6 @@ obj-$(CONFIG_PCIE_CADENCE_HOST) += pcie-cadence-host.o obj-$(CONFIG_PCIE_CADENCE_EP) += pcie-cadence-ep.o obj-$(CONFIG_PCIE_CADENCE_PLAT) += pcie-cadence-plat.o obj-$(CONFIG_PCI_J721E) += pci-j721e.o +pci_j721e-y := pci-j721e.o pcie-cadence.o obj-$(CONFIG_PCIE_SG2042_HOST) += pcie-sg2042.o +pci_sg2042_host-y := pci-sg2042.o pcie-cadence.o
If either of PCI_J721E or SG2042_HOST is selected as a built-in module, then pcie-cadence-host.c, pcie-cadence-ep.c and pcie-cadence.c drivers will be built-in. If both PCI_J721E and SG2042_HOST are selected as loadable modules, only then the library drivers will be enabled as loadable modules.
Please let me know what you think.
I don't think that the version above does what you want, this would build the pcie-cadence.o file into three separate modules and break in additional ways if a subset of them are built-in.
I would still suggest combining pcie-cadence{,-ep,-host}.o into one module that is used by the other drivers, as that would address the build failure you are observing.
An alternative would be to change the pcie-j721e.c file to only reference the host portion if host support is enabled for this driver.
While 'pcie-cadence.h' handles the case where 'PCIE_CADENCE_HOST' is not defined:
#if IS_ENABLED(CONFIG_PCIE_CADENCE_HOST) ... void cdns_pcie_host_disable(struct cdns_pcie_rc *rc); ... #else ... static inline void cdns_pcie_host_disable(struct cdns_pcie_rc *rc) { } ... #endif
the issue occurs because PCIE_SG2042_HOST enables CONFIG_PCIE_CADENCE_HOST but it is enabled as 'm'. As a result, the definition exists in pcie- cadence-host.c that is built as a loadable module which is not accessible by pci-j721e.c that is built-in.
I understand that the solution should be fixing the pci-j721e.c driver rather than updating Kconfig or Makefile. Thank you for the feedback. I will update the pci-j721e.c driver to handle the case that is triggering the build error.
Regards, Siddharth.