]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI: hisi: Use devm_ghes_register_vendor_record_notifier()
authorKai-Heng Feng <kaihengf@nvidia.com>
Mon, 30 Mar 2026 09:41:56 +0000 (17:41 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 6 Apr 2026 14:48:58 +0000 (16:48 +0200)
Switch to the device-managed variant so the notifier is automatically
unregistered on device removal, allowing the open-coded remove callback
to be dropped entirely.

Signed-off-by: Kai-Heng Feng <kaihengf@nvidia.com>
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Shiju Jose <shiju.jose@huawei.com>
Link: https://patch.msgid.link/20260330094203.38022-3-kaihengf@nvidia.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/pci/controller/pcie-hisi-error.c

index aaf1ed2b6e5971c98d404583561dfb1b7d0a279a..36be86d827a828c1080e4d690cb41a8822f605d2 100644 (file)
@@ -287,25 +287,16 @@ static int hisi_pcie_error_handler_probe(struct platform_device *pdev)
 
        priv->nb.notifier_call = hisi_pcie_notify_error;
        priv->dev = &pdev->dev;
-       ret = ghes_register_vendor_record_notifier(&priv->nb);
+       ret = devm_ghes_register_vendor_record_notifier(&pdev->dev, &priv->nb);
        if (ret) {
                dev_err(&pdev->dev,
                        "Failed to register hisi pcie controller error handler with apei\n");
                return ret;
        }
 
-       platform_set_drvdata(pdev, priv);
-
        return 0;
 }
 
-static void hisi_pcie_error_handler_remove(struct platform_device *pdev)
-{
-       struct hisi_pcie_error_private *priv = platform_get_drvdata(pdev);
-
-       ghes_unregister_vendor_record_notifier(&priv->nb);
-}
-
 static const struct acpi_device_id hisi_pcie_acpi_match[] = {
        { "HISI0361", 0 },
        { }
@@ -317,7 +308,6 @@ static struct platform_driver hisi_pcie_error_handler_driver = {
                .acpi_match_table = hisi_pcie_acpi_match,
        },
        .probe          = hisi_pcie_error_handler_probe,
-       .remove         = hisi_pcie_error_handler_remove,
 };
 module_platform_driver(hisi_pcie_error_handler_driver);