diff options
author | Kurt Borja <kuurtb@gmail.com> | 2025-01-15 19:27:07 -0500 |
---|---|---|
committer | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2025-01-16 17:26:30 +0200 |
commit | 58d5629dc8b8b8d9928fc649d9f2aaa361a8a5c5 (patch) | |
tree | b66e4f7da4e1ab555cb23b74860c204748cbc4fc /drivers/acpi | |
parent | b5ca1a4488a5e6dfb9962e2319c03c7414e50ec3 (diff) |
ACPI: platform_profile: Add `probe` to platform_profile_ops
Add a `probe` callback to platform_profile_ops, which lets drivers
initialize the choices member manually. This is a step towards
unexposing the struct platform_profile_handler from the consumer
drivers.
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20250116002721.75592-6-kuurtb@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/platform_profile.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 161a05d57b0f..120f8402facd 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -465,12 +465,23 @@ int platform_profile_register(struct platform_profile_handler *pprof, void *drvd int err; /* Sanity check the profile handler */ - if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) || - !pprof->ops->profile_set || !pprof->ops->profile_get) { + if (!pprof || !pprof->ops->profile_set || !pprof->ops->profile_get || + !pprof->ops->probe) { pr_err("platform_profile: handler is invalid\n"); return -EINVAL; } + err = pprof->ops->probe(drvdata, pprof->choices); + if (err) { + dev_err(pprof->dev, "platform_profile probe failed\n"); + return err; + } + + if (bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST)) { + dev_err(pprof->dev, "Failed to register a platform_profile class device with empty choices\n"); + return -EINVAL; + } + guard(mutex)(&profile_lock); /* create class interface for individual handler */ |