Skip to contentSkip to conversation

PCI: tegra: Fix building Tegra194 PCIe driver

PATCH Superseded Jon Hunter 2 participants 3 messages May 19, 2021

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Jon Hunter

author maintainer
#0 lore raw

PATCH 1/1 PCI: tegra: Fix building Tegra194 PCIe driver

Commit 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM errata") caused a couple build regressions for the Tegra194 PCIe driver which are:

1. The Tegra194 PCIe driver can no longer be built as a module. This was caused by removing the Makefile entry to build the pcie-tegra.c based upon the CONFIG_PCIE_TEGRA194 option. Therefore, restore this so that we can build the driver as a module if ACPI support is not enabled in the kernel.
2. If CONFIG_PCIE_TEGRA194 is configured to build the driver as a module, at the same time that CONFIG_ACPI and CONFIG_PCI_QUIRKS are selected to build the driver into the kernel, then the necessary functions in the driver to probe and remove the device when booting with device-tree and not compiled into to the driver. This prevents the PCIe devices being probed when booting with device-tree. Fix this by using the IS_ENABLED() macro.

---
 drivers/pci/controller/dwc/Makefile        | 1 +
 drivers/pci/controller/dwc/pcie-tegra194.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/Makefile +1 -0
index eca805c1a023..f0d1e2d8c022 100644
@@ -32,6 +32,7 @@ obj-$(CONFIG_PCIE_UNIPHIER_EP) += pcie-uniphier-ep.o
 # depending on whether ACPI, the DT driver, or both are enabled.
 
 obj-$(CONFIG_PCIE_AL) += pcie-al.o
+obj-$(CONFIG_PCIE_TEGRA194) += pcie-tegra194.o
 obj-$(CONFIG_PCI_HISI) += pcie-hisi.o
 
 ifdef CONFIG_ACPI
drivers/pci/controller/dwc/pcie-tegra194.c +1 -1
index b19775ab134e..8bda1485d0c2 100644
@@ -409,7 +409,7 @@ const struct pci_ecam_ops tegra194_pcie_ops = {
 };
 #endif /* defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS) */
 
-#ifdef CONFIG_PCIE_TEGRA194
+#if IS_ENABLED(CONFIG_PCIE_TEGRA194)
 
 static inline struct tegra_pcie_dw *to_tegra_pcie(struct dw_pcie *pci)
 {
Signature · 1 line
2.25.1
#1 lore raw

Hi Jon,

Quoted 4 lines

Commit 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM errata") caused a couple build regressions for the Tegra194 PCIe driver which are:

Quoted 12 lines

1. The Tegra194 PCIe driver can no longer be built as a module. This was caused by removing the Makefile entry to build the pcie-tegra.c based upon the CONFIG_PCIE_TEGRA194 option. Therefore, restore this so that we can build the driver as a module if ACPI support is not enabled in the kernel.
2. If CONFIG_PCIE_TEGRA194 is configured to build the driver as a module, at the same time that CONFIG_ACPI and CONFIG_PCI_QUIRKS are selected to build the driver into the kernel, then the necessary functions in the driver to probe and remove the device when booting with device-tree and not compiled into to the driver. This prevents the PCIe devices being probed when booting with device-tree. Fix this by using the IS_ENABLED() macro.

Thank you for fixing this! Much appreciated.

There are also few build time warnings related to these changes you mention above, as per:

drivers/pci/controller/dwc/pcie-tegra194.c:259:18: warning: ‘event_cntr_data_offset’ defined but not used [-Wunused-const-variable=] drivers/pci/controller/dwc/pcie-tegra194.c:250:18: warning: ‘event_cntr_ctrl_offset’ defined but not used [-Wunused-const-variable=] drivers/pci/controller/dwc/pcie-tegra194.c:243:27: warning: ‘pcie_gen_freq’ defined but not used [-Wunused-const-variable=]

We could bill two birds with one stone, so to speak, and move these variables into the block behind the CONFIG_PCIE_TEGRA194 and CONFIG_PCIEASPM guards respectively, so that these symbols are no longer unused.

Also, since this change fixes and issue introduced in a different commit, then it would be prudent to add the "Fixes:" tag.

Krzysztof

author maintainer
#2 lore raw

Hi Krzysztof,

Quoted 24 lines · Krzysztof Wilczyński

Hi Jon,

Quoted 4 lines

Commit 7f100744749e ("PCI: tegra: Add Tegra194 MCFG quirks for ECAM errata") caused a couple build regressions for the Tegra194 PCIe driver which are:

Quoted 12 lines

1. The Tegra194 PCIe driver can no longer be built as a module. This was caused by removing the Makefile entry to build the pcie-tegra.c based upon the CONFIG_PCIE_TEGRA194 option. Therefore, restore this so that we can build the driver as a module if ACPI support is not enabled in the kernel.
2. If CONFIG_PCIE_TEGRA194 is configured to build the driver as a module, at the same time that CONFIG_ACPI and CONFIG_PCI_QUIRKS are selected to build the driver into the kernel, then the necessary functions in the driver to probe and remove the device when booting with device-tree and not compiled into to the driver. This prevents the PCIe devices being probed when booting with device-tree. Fix this by using the IS_ENABLED() macro.

Thank you for fixing this! Much appreciated.

There are also few build time warnings related to these changes you mention above, as per:

Quoted 8 lines

drivers/pci/controller/dwc/pcie-tegra194.c:259:18: warning: ‘event_cntr_data_offset’ defined but not used [-Wunused-const-variable=] drivers/pci/controller/dwc/pcie-tegra194.c:250:18: warning: ‘event_cntr_ctrl_offset’ defined but not used [-Wunused-const-variable=] drivers/pci/controller/dwc/pcie-tegra194.c:243:27: warning: ‘pcie_gen_freq’ defined but not used [-Wunused-const-variable=]

We could bill two birds with one stone, so to speak, and move these variables into the block behind the CONFIG_PCIE_TEGRA194 and CONFIG_PCIEASPM guards respectively, so that these symbols are no longer unused.

Ah good to know. Yes I can incorporate into this change as well. Thanks for letting me know.

Quoted 2 lines

Also, since this change fixes and issue introduced in a different commit, then it would be prudent to add the "Fixes:" tag.

Yes it would. I had missed that, but will add.

Thanks!
Jon

Signature · 1 line
nvpublic