[PATCH] PCI: cadence: Kconfig: change PCIE_CADENCE configs from tristate to bool
Siddharth Vadapalli
s-vadapalli at ti.com
Thu Nov 13 21:47:08 PST 2025
On Thu, 2025-11-13 at 11:13 +0100, Arnd Bergmann wrote:
Hello Arnd,
> On Thu, Nov 13, 2025, at 10:27, Siddharth Vadapalli wrote:
> > The drivers associated with the PCIE_CADENCE, PCIE_CADENCE_HOST AND
> > PCIE_CADENCE_EP configs are used by multiple vendor drivers and serve as a
> > library of helpers. Since the vendor drivers could individually be built
> > as built-in or as loadable modules, it is possible to select a build
> > configuration wherein a vendor driver is built-in while the library is
> > built as a loadable module. This will result in a build error as reported
> > in the 'Closes' link below.
> >
> > Address the build error by changing the library configs to be 'bool'
> > instead of 'tristate'.
> >
> > Reported-by: kernel test robot <lkp at intel.com>
> > Closes:
> > https://lore.kernel.org/oe-kbuild-all/202511111705.MZ7ls8Hm-lkp@intel.com/
> > Fixes: 1c72774df028 ("PCI: sg2042: Add Sophgo SG2042 PCIe driver")
> > Cc: <stable at vger.kernel.org>
> > Signed-off-by: Siddharth Vadapalli <s-vadapalli at ti.com>
>
> I really think there has to be a better solution here, this is not
> an unusual problem.
>
> > @@ -4,16 +4,16 @@ menu "Cadence-based PCIe controllers"
> > depends on PCI
> >
> > config PCIE_CADENCE
> > - tristate
> > + bool
> >
> > config PCIE_CADENCE_HOST
> > - tristate
> > + bool
> > depends on OF
> > select IRQ_DOMAIN
> > select PCIE_CADENCE
> >
> > config PCIE_CADENCE_EP
> > - tristate
> > + bool
> > depends on OF
> > depends on PCI_ENDPOINT
> > select PCIE_CADENCE
>
> I think the easiest way would be to leave PCIE_CADENCE as
> a 'tristate' symbol but make the other two 'bool', and then
> adjust the Makefile logic to use CONFIG_PCIE_CADENCE as
> the thing that controls how the individual drivers are built.
>
> That way, if any platform specific driver is built-in, both
> the EP and HOST support are built-in or disabled but never
> loadable modules. As long as all platform drivers are
> loadable modules, so would be the base support.
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.
Regards,
Siddharth.
More information about the linux-arm-kernel
mailing list