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

ACPI: PRM: Add acpi_prm_handler_available()

Add a helper function to check if a PRM handler/module is present.

This can be used during init time by code that depends on a particular
handler. If the handler is not present, then the code does not need to
be loaded.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: "Mario Limonciello (AMD)" <superm1@kernel.org>
Acked-by: "Rafael J. Wysocki (Intel)" <rafael@kernel.org>
Link: https://patch.msgid.link/all/20251017-wip-atl-prm-v2-1-7ab1df4a5fbc@amd.com

authored by

Yazen Ghannam and committed by
Borislav Petkov (AMD)
83be4bee 6553c68b

+8
+6
drivers/acpi/prmt.c
··· 244 244 return (struct prm_handler_info *) find_guid_info(guid, GET_HANDLER); 245 245 } 246 246 247 + bool acpi_prm_handler_available(const guid_t *guid) 248 + { 249 + return find_prm_handler(guid) && find_prm_module(guid); 250 + } 251 + EXPORT_SYMBOL_GPL(acpi_prm_handler_available); 252 + 247 253 /* In-coming PRM commands */ 248 254 249 255 #define PRM_CMD_RUN_SERVICE 0
+2
include/linux/prmt.h
··· 4 4 5 5 #ifdef CONFIG_ACPI_PRMT 6 6 void init_prmt(void); 7 + bool acpi_prm_handler_available(const guid_t *handler_guid); 7 8 int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer); 8 9 #else 9 10 static inline void init_prmt(void) { } 11 + static inline bool acpi_prm_handler_available(const guid_t *handler_guid) { return false; } 10 12 static inline int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer) 11 13 { 12 14 return -EOPNOTSUPP;