Skip to content

Commit 83be4be

Browse files
yghannambp3tk0v
authored andcommitted
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
1 parent 6553c68 commit 83be4be

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/acpi/prmt.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ static struct prm_handler_info *find_prm_handler(const guid_t *guid)
244244
return (struct prm_handler_info *) find_guid_info(guid, GET_HANDLER);
245245
}
246246

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+
247253
/* In-coming PRM commands */
248254

249255
#define PRM_CMD_RUN_SERVICE 0

include/linux/prmt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
#ifdef CONFIG_ACPI_PRMT
66
void init_prmt(void);
7+
bool acpi_prm_handler_available(const guid_t *handler_guid);
78
int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer);
89
#else
910
static inline void init_prmt(void) { }
11+
static inline bool acpi_prm_handler_available(const guid_t *handler_guid) { return false; }
1012
static inline int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer)
1113
{
1214
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)