Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

Signed-off-by: Kai-Heng Feng <kaihengf@nvidia.com>
Reviewed-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Shiju Jose <shiju.jose@huawei.com>
Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>
Link: https://patch.msgid.link/20260330094203.38022-2-kaihengf@nvidia.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Kai-Heng Feng and committed by
Rafael J. Wysocki
441fa10a 591cd656

+29
+18
drivers/acpi/apei/ghes.c
··· 689 689 } 690 690 EXPORT_SYMBOL_GPL(ghes_unregister_vendor_record_notifier); 691 691 692 + static void ghes_vendor_record_notifier_destroy(void *nb) 693 + { 694 + ghes_unregister_vendor_record_notifier(nb); 695 + } 696 + 697 + int devm_ghes_register_vendor_record_notifier(struct device *dev, 698 + struct notifier_block *nb) 699 + { 700 + int ret; 701 + 702 + ret = ghes_register_vendor_record_notifier(nb); 703 + if (ret) 704 + return ret; 705 + 706 + return devm_add_action_or_reset(dev, ghes_vendor_record_notifier_destroy, nb); 707 + } 708 + EXPORT_SYMBOL_GPL(devm_ghes_register_vendor_record_notifier); 709 + 692 710 static void ghes_vendor_record_work_func(struct work_struct *work) 693 711 { 694 712 struct ghes_vendor_record_entry *entry;
+11
include/acpi/ghes.h
··· 71 71 */ 72 72 void ghes_unregister_vendor_record_notifier(struct notifier_block *nb); 73 73 74 + /** 75 + * devm_ghes_register_vendor_record_notifier - device-managed vendor 76 + * record notifier registration. 77 + * @dev: device that owns the notifier lifetime 78 + * @nb: pointer to the notifier_block structure of the vendor record handler 79 + * 80 + * Return: 0 on success, negative errno on failure. 81 + */ 82 + int devm_ghes_register_vendor_record_notifier(struct device *dev, 83 + struct notifier_block *nb); 84 + 74 85 struct list_head *ghes_get_devices(void); 75 86 76 87 void ghes_estatus_pool_region_free(unsigned long addr, u32 size);