]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI: meson: Add missing remove callback
authorShuvam Pandey <shuvampandey1@gmail.com>
Mon, 18 May 2026 16:59:18 +0000 (22:44 +0545)
committerManivannan Sadhasivam <mani@kernel.org>
Tue, 9 Jun 2026 16:40:54 +0000 (22:10 +0530)
meson_pcie_probe() powers on the PHY and registers the DesignWare host
bridge with dw_pcie_host_init(), but the driver has no remove callback.
On driver unbind or module unload, the driver core therefore proceeds to
devres cleanup without first unregistering the host bridge or powering off
the PHY.

Add a remove callback that deinitializes the DesignWare host bridge and
powers off the PHY while device-managed resources are still valid.

Fixes: 9c0ef6d34fdb ("PCI: amlogic: Add the Amlogic Meson PCIe controller driver")
Signed-off-by: Shuvam Pandey <shuvampandey1@gmail.com>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/1a0c86ab264cdc1c79c917e984b90991af51d827.1779123847.git.shuvampandey1@gmail.com
drivers/pci/controller/dwc/pci-meson.c

index 8d495bcc3a41ae5b52a448282b4787e12c039664..225d887cd0a3e14bdf5cc1c8c7398bf6aa20605f 100644 (file)
@@ -453,6 +453,14 @@ err_phy:
        return ret;
 }
 
+static void meson_pcie_remove(struct platform_device *pdev)
+{
+       struct meson_pcie *mp = platform_get_drvdata(pdev);
+
+       dw_pcie_host_deinit(&mp->pci.pp);
+       meson_pcie_power_off(mp);
+}
+
 static const struct of_device_id meson_pcie_of_match[] = {
        {
                .compatible = "amlogic,axg-pcie",
@@ -466,6 +474,7 @@ MODULE_DEVICE_TABLE(of, meson_pcie_of_match);
 
 static struct platform_driver meson_pcie_driver = {
        .probe = meson_pcie_probe,
+       .remove = meson_pcie_remove,
        .driver = {
                .name = "meson-pcie",
                .of_match_table = meson_pcie_of_match,