diff mbox series

[v6,3/3] PCI: tegra: Allow building as a module

Message ID 20250507-pci-tegra-module-v6-3-5fe363eaa302@gmail.com
State New
Headers show
Series PCI: tegra: Allow building as a module | expand

Commit Message

Aaron Kling via B4 Relay May 8, 2025, 3:25 a.m. UTC
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 | 35 ++++-------------------------------
 2 files changed, 5 insertions(+), 32 deletions(-)

Comments

Aaron Kling May 28, 2025, 5:25 p.m. UTC | #1
On Thu, May 8, 2025 at 6:26 AM Aaron Kling <webgeek1234@gmail.com> wrote:
>
> On Thu, May 8, 2025 at 3:40 AM Thierry Reding <thierry.reding@gmail.com> wrote:
> >
> > On Wed, May 07, 2025 at 10:25:54PM -0500, Aaron Kling via B4 Relay wrote:
> > > 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.
> >
> > What exactly are these concerns? I haven't done this lately, but I'm
> > pretty sure that unbinding the PCI controller is something that I
> > extensively tested back when this code was introduced. PCI is designed
> > to be hot-pluggable, so there shouldn't be a need to prevent unloading
> > of the controller.
> >
> > Rather than just forcing this to be always there, can we not fix any
> > issues and keep this unloadable?
>
> For the short version, see this part of the conversation on v1 [0].
> For the long version, read comments on all revisions. Basically, I
> originally submitted this as unloadable, but got told that due to
> generic concerns that affect all pci drivers, including ones already
> modules and unloadable, making this one a module would be blocked if
> it was unloadable. Which leads us to this revision of the series.
>
> Sincerely,
> Aaron
>
> [0] https://lore.kernel.org/all/4u4h27w77sdjvy43b3yonidhfjuvljylms3qxqfaqwyw3v32qo@kzgrrenxr6yz/

Is there any more comments on this, Manivannan or Thierry? I'd like to
get some form of this series submitted.

Sincerely,
Aaron
diff mbox series

Patch

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..b902c696f63310f8f70651976d0fa2d9337134a2 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -2595,12 +2595,6 @@  static const struct seq_operations tegra_pcie_ports_sops = {
 
 DEFINE_SEQ_ATTRIBUTE(tegra_pcie_ports);
 
-static void tegra_pcie_debugfs_exit(struct tegra_pcie *pcie)
-{
-	debugfs_remove_recursive(pcie->debugfs);
-	pcie->debugfs = NULL;
-}
-
 static void tegra_pcie_debugfs_init(struct tegra_pcie *pcie)
 {
 	pcie->debugfs = debugfs_create_dir("pcie", NULL);
@@ -2674,29 +2668,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 +2771,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");