diff options
| author | Kurt Borja <[email protected]> | 2025-01-16 00:27:07 +0000 |
|---|---|---|
| committer | Ilpo Järvinen <[email protected]> | 2025-01-16 15:26:30 +0000 |
| commit | 58d5629dc8b8b8d9928fc649d9f2aaa361a8a5c5 (patch) | |
| tree | b66e4f7da4e1ab555cb23b74860c204748cbc4fc /drivers/acpi/platform_profile.c | |
| parent | ACPI: platform_profile: Add `ops` member to handlers (diff) | |
| download | kernel-58d5629dc8b8b8d9928fc649d9f2aaa361a8a5c5.tar.gz kernel-58d5629dc8b8b8d9928fc649d9f2aaa361a8a5c5.zip | |
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 <[email protected]>
Signed-off-by: Kurt Borja <[email protected]>
Reviewed-by: Mark Pearson <[email protected]>
Tested-by: Mark Pearson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Ilpo Järvinen <[email protected]>
Diffstat (limited to 'drivers/acpi/platform_profile.c')
| -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 */ |
