public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 2/3] PCI: hisi: Use devm_ghes_register_vendor_record_notifier()
       [not found] <20260319111315.87624-1-kaihengf@nvidia.com>
@ 2026-03-19 11:13 ` Kai-Heng Feng
  2026-03-20  9:57   ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Kai-Heng Feng @ 2026-03-19 11:13 UTC (permalink / raw)
  To: rafael
  Cc: Kai-Heng Feng, Jonathan Cameron, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas, linux-pci, linux-kernel

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.

Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Kai-Heng Feng <kaihengf@nvidia.com>
---
v2:
 - New patch.

 drivers/pci/controller/pcie-hisi-error.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/pci/controller/pcie-hisi-error.c b/drivers/pci/controller/pcie-hisi-error.c
index aaf1ed2b6e59..36be86d827a8 100644
--- a/drivers/pci/controller/pcie-hisi-error.c
+++ b/drivers/pci/controller/pcie-hisi-error.c
@@ -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);
 
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 2/3] PCI: hisi: Use devm_ghes_register_vendor_record_notifier()
  2026-03-19 11:13 ` [PATCH v2 2/3] PCI: hisi: Use devm_ghes_register_vendor_record_notifier() Kai-Heng Feng
@ 2026-03-20  9:57   ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2026-03-20  9:57 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: rafael, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, linux-pci,
	linux-kernel, shiju.jose

On Thu, 19 Mar 2026 19:13:08 +0800
Kai-Heng Feng <kaihengf@nvidia.com> wrote:

> 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.
> 
> Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
> Signed-off-by: Kai-Heng Feng <kaihengf@nvidia.com>
+CC Shiju.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> ---
> v2:
>  - New patch.
> 
>  drivers/pci/controller/pcie-hisi-error.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-hisi-error.c b/drivers/pci/controller/pcie-hisi-error.c
> index aaf1ed2b6e59..36be86d827a8 100644
> --- a/drivers/pci/controller/pcie-hisi-error.c
> +++ b/drivers/pci/controller/pcie-hisi-error.c
> @@ -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);
>  


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-20  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260319111315.87624-1-kaihengf@nvidia.com>
2026-03-19 11:13 ` [PATCH v2 2/3] PCI: hisi: Use devm_ghes_register_vendor_record_notifier() Kai-Heng Feng
2026-03-20  9:57   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox