[PATCH v5 3/3] PCI: tegra: Allow building as a module

Aaron Kling via B4 Relay posted 3 patches 7 months, 2 weeks ago
There is a newer version of this series
[PATCH v5 3/3] PCI: tegra: Allow building as a module
Posted by Aaron Kling via B4 Relay 7 months, 2 weeks ago
From: Aaron Kling <webgeek1234@gmail.com>

This changes the module macro back to builtin, which does not define an
exit function. This will prevent the module from being unloaded. There
are concerns with modules not cleaning up IRQs on unload, thus this
needs specifically disallowed. The remove callback is also dropped as it
is unused.

Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
 drivers/pci/controller/Kconfig     |  2 +-
 drivers/pci/controller/pci-tegra.c | 29 ++++-------------------------
 2 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
index 9800b768105402d6dd1ba4b134c2ec23da6e4201..a9164dd2eccaead5ae9348c24a5ad75fcb40f507 100644
--- a/drivers/pci/controller/Kconfig
+++ b/drivers/pci/controller/Kconfig
@@ -224,7 +224,7 @@ config PCI_HYPERV_INTERFACE
 	  driver.
 
 config PCI_TEGRA
-	bool "NVIDIA Tegra PCIe controller"
+	tristate "NVIDIA Tegra PCIe controller"
 	depends on ARCH_TEGRA || COMPILE_TEST
 	depends on PCI_MSI
 	help
diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index b3cdbc5927de3742161310610dc5dcb836f5dd69..e2d976c126817808933ca936cf650088157283be 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -2674,29 +2674,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
 	return err;
 }
 
-static void tegra_pcie_remove(struct platform_device *pdev)
-{
-	struct tegra_pcie *pcie = platform_get_drvdata(pdev);
-	struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
-	struct tegra_pcie_port *port, *tmp;
-
-	if (IS_ENABLED(CONFIG_DEBUG_FS))
-		tegra_pcie_debugfs_exit(pcie);
-
-	pci_stop_root_bus(host->bus);
-	pci_remove_root_bus(host->bus);
-	pm_runtime_put_sync(pcie->dev);
-	pm_runtime_disable(pcie->dev);
-
-	if (IS_ENABLED(CONFIG_PCI_MSI))
-		tegra_pcie_msi_teardown(pcie);
-
-	tegra_pcie_put_resources(pcie);
-
-	list_for_each_entry_safe(port, tmp, &pcie->ports, list)
-		tegra_pcie_port_free(port);
-}
-
 static int tegra_pcie_pm_suspend(struct device *dev)
 {
 	struct tegra_pcie *pcie = dev_get_drvdata(dev);
@@ -2800,6 +2777,8 @@ static struct platform_driver tegra_pcie_driver = {
 		.pm = &tegra_pcie_pm_ops,
 	},
 	.probe = tegra_pcie_probe,
-	.remove = tegra_pcie_remove,
 };
-module_platform_driver(tegra_pcie_driver);
+builtin_platform_driver(tegra_pcie_driver);
+MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
+MODULE_DESCRIPTION("NVIDIA PCI host controller driver");
+MODULE_LICENSE("GPL");

-- 
2.48.1
Re: [PATCH v5 3/3] PCI: tegra: Allow building as a module
Posted by kernel test robot 7 months, 1 week ago
Hi Aaron,

kernel test robot noticed the following build warnings:

[auto build test WARNING on pci/next]
[also build test WARNING on pci/for-linus tip/irq/core tegra/for-next linus/master v6.15-rc5 next-20250507]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Aaron-Kling-via-B4-Relay/cpuidle-tegra-Export-tegra_cpuidle_pcie_irqs_in_use/20250506-102907
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link:    https://lore.kernel.org/r/20250505-pci-tegra-module-v5-3-827aaac998ba%40gmail.com
patch subject: [PATCH v5 3/3] PCI: tegra: Allow building as a module
config: openrisc-allyesconfig (https://download.01.org/0day-ci/archive/20250508/202505080510.T9Y6L5rd-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250508/202505080510.T9Y6L5rd-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505080510.T9Y6L5rd-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/pci/controller/pci-tegra.c:2574:13: warning: 'tegra_pcie_debugfs_exit' defined but not used [-Wunused-function]
    2574 | static void tegra_pcie_debugfs_exit(struct tegra_pcie *pcie)
         |             ^~~~~~~~~~~~~~~~~~~~~~~


vim +/tegra_pcie_debugfs_exit +2574 drivers/pci/controller/pci-tegra.c

2cb989f6e99aa8 drivers/pci/host/pci-tegra.c Thierry Reding       2014-07-22  2573  
662b94c3195654 drivers/pci/host/pci-tegra.c Manikanta Maddireddy 2018-02-28 @2574  static void tegra_pcie_debugfs_exit(struct tegra_pcie *pcie)
662b94c3195654 drivers/pci/host/pci-tegra.c Manikanta Maddireddy 2018-02-28  2575  {
662b94c3195654 drivers/pci/host/pci-tegra.c Manikanta Maddireddy 2018-02-28  2576  	debugfs_remove_recursive(pcie->debugfs);
662b94c3195654 drivers/pci/host/pci-tegra.c Manikanta Maddireddy 2018-02-28  2577  	pcie->debugfs = NULL;
662b94c3195654 drivers/pci/host/pci-tegra.c Manikanta Maddireddy 2018-02-28  2578  }
662b94c3195654 drivers/pci/host/pci-tegra.c Manikanta Maddireddy 2018-02-28  2579  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki