summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/dell/dell-pc.c
diff options
context:
space:
mode:
authorKurt Borja <kuurtb@gmail.com>2025-01-15 19:27:17 -0500
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2025-01-17 19:15:59 +0200
commit07f531b395db3cd1776ef0f7191abf4b077fcf21 (patch)
tree2356cbb64ef1bb5af2ca4f4bb3b79caf7d5ed251 /drivers/platform/x86/dell/dell-pc.c
parent31658c916fa692b7dfceaba6fc6320b81c05b9c2 (diff)
ACPI: platform_profile: Remove platform_profile_handler from exported symbols
In order to protect the platform_profile_handler from API consumers, allocate it in platform_profile_register() and modify it's signature accordingly. Remove the platform_profile_handler from all consumer drivers and replace them with a pointer to the class device, which is now returned from platform_profile_register(). Replace *pprof with a pointer to the class device in the rest of exported symbols. 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-16-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/platform/x86/dell/dell-pc.c')
-rw-r--r--drivers/platform/x86/dell/dell-pc.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c
index 2759bb608b1a..483240bb36e7 100644
--- a/drivers/platform/x86/dell/dell-pc.c
+++ b/drivers/platform/x86/dell/dell-pc.c
@@ -109,8 +109,6 @@ MODULE_DEVICE_TABLE(dmi, dell_device_table);
#define DELL_ACC_SET_FIELD GENMASK(11, 8)
#define DELL_THERMAL_SUPPORTED GENMASK(3, 0)
-static struct platform_profile_handler *thermal_handler;
-
enum thermal_mode_bits {
DELL_BALANCED = BIT(0),
DELL_COOL_BOTTOM = BIT(1),
@@ -254,6 +252,7 @@ static const struct platform_profile_ops dell_pc_platform_profile_ops = {
static int thermal_init(void)
{
+ struct device *ppdev;
int ret;
/* If thermal commands are not supported, exit without error */
@@ -271,25 +270,15 @@ static int thermal_init(void)
if (IS_ERR(platform_device))
return PTR_ERR(platform_device);
- thermal_handler = devm_kzalloc(&platform_device->dev, sizeof(*thermal_handler), GFP_KERNEL);
- if (!thermal_handler) {
- ret = -ENOMEM;
+ ppdev = devm_platform_profile_register(&platform_device->dev, "dell-pc",
+ NULL, &dell_pc_platform_profile_ops);
+ if (IS_ERR(ppdev)) {
+ ret = PTR_ERR(ppdev);
goto cleanup_platform_device;
}
- thermal_handler->name = "dell-pc";
- thermal_handler->dev = &platform_device->dev;
- thermal_handler->ops = &dell_pc_platform_profile_ops;
-
- /* Clean up if failed */
- ret = devm_platform_profile_register(thermal_handler, NULL);
- if (ret)
- goto cleanup_thermal_handler;
return 0;
-cleanup_thermal_handler:
- thermal_handler = NULL;
-
cleanup_platform_device:
platform_device_unregister(platform_device);