RE: [PATCH v3 1/3] ACPI: APEI: GHES: Add devm_ghes_register_vendor_record_notifier()

From: Shiju Jose

Date: Tue Mar 31 2026 - 10:47:10 EST


>-----Original Message-----
>From: Kai-Heng Feng <kaihengf@xxxxxxxxxx>
>Sent: 30 March 2026 10:42
>To: rafael@xxxxxxxxxx
>Cc: Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>;
>helgaas@xxxxxxxxxx; Guohanjun (Hanjun Guo) <guohanjun@xxxxxxxxxx>;
>linux-kernel@xxxxxxxxxxxxxxx; linux-acpi@xxxxxxxxxxxxxxx; linux-
>pci@xxxxxxxxxxxxxxx; acpica-devel@xxxxxxxxxxxxxxx; linux-
>hardening@xxxxxxxxxxxxxxx; Kai-Heng Feng <kaihengf@xxxxxxxxxx>; Shiju Jose
><shiju.jose@xxxxxxxxxx>; Tony Luck <tony.luck@xxxxxxxxx>; Borislav Petkov
><bp@xxxxxxxxx>; Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>; Shuai Xue
><xueshuai@xxxxxxxxxxxxxxxxx>; Len Brown <lenb@xxxxxxxxxx>; Robert Moore
><robert.moore@xxxxxxxxx>; Fabio M. De Francesco
><fabio.m.de.francesco@xxxxxxxxxxxxxxx>; Breno Leitao <leitao@xxxxxxxxxx>;
>Jason Tian <jason@xxxxxxxxxxxxxxxxxxxxxx>
>Subject: [PATCH v3 1/3] ACPI: APEI: GHES: Add
>devm_ghes_register_vendor_record_notifier()
>
>Add a device-managed wrapper around
>ghes_register_vendor_record_notifier()
>so drivers can avoid manual cleanup on device removal or probe failure.
>
>Cc: Shiju Jose <shiju.jose@xxxxxxxxxx>
>Cc: Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>
>Signed-off-by: Kai-Heng Feng <kaihengf@xxxxxxxxxx>

Reviewed-by: Shiju Jose <shiju.jose@xxxxxxxxxx>
>---
>v3:
> - Change patch title
> - Move documentation to header file.
>v2:
> - New patch.
>
> drivers/acpi/apei/ghes.c | 18 ++++++++++++++++++
> include/acpi/ghes.h | 11 +++++++++++
> 2 files changed, 29 insertions(+)
>
>diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index
>8acd2742bb27..3236a3ce79d6 100644
>--- a/drivers/acpi/apei/ghes.c
>+++ b/drivers/acpi/apei/ghes.c
>@@ -689,6 +689,24 @@ void ghes_unregister_vendor_record_notifier(struct
>notifier_block *nb) }
>EXPORT_SYMBOL_GPL(ghes_unregister_vendor_record_notifier);
>
>+static void ghes_vendor_record_notifier_destroy(void *nb) {
>+ ghes_unregister_vendor_record_notifier(nb);
>+}
>+
>+int devm_ghes_register_vendor_record_notifier(struct device *dev,
>+ struct notifier_block *nb)
>+{
>+ int ret;
>+
>+ ret = ghes_register_vendor_record_notifier(nb);
>+ if (ret)
>+ return ret;
>+
>+ return devm_add_action_or_reset(dev,
>+ghes_vendor_record_notifier_destroy, nb); }
>+EXPORT_SYMBOL_GPL(devm_ghes_register_vendor_record_notifier);
>+
> static void ghes_vendor_record_work_func(struct work_struct *work) {
> struct ghes_vendor_record_entry *entry; diff --git
>a/include/acpi/ghes.h b/include/acpi/ghes.h index
>7bea522c0657..8d7e5caef3f1 100644
>--- a/include/acpi/ghes.h
>+++ b/include/acpi/ghes.h
>@@ -71,6 +71,17 @@ int ghes_register_vendor_record_notifier(struct
>notifier_block *nb);
> */
> void ghes_unregister_vendor_record_notifier(struct notifier_block *nb);
>
>+/**
>+ * devm_ghes_register_vendor_record_notifier - device-managed vendor
>+ * record notifier registration.
>+ * @dev: device that owns the notifier lifetime
>+ * @nb: pointer to the notifier_block structure of the vendor record
>+handler
>+ *
>+ * Return: 0 on success, negative errno on failure.
>+ */
>+int devm_ghes_register_vendor_record_notifier(struct device *dev,
>+ struct notifier_block *nb);
>+
> struct list_head *ghes_get_devices(void);
>
> void ghes_estatus_pool_region_free(unsigned long addr, u32 size);
>--
>2.50.1 (Apple Git-155)
>