aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/platform_profile.c
diff options
context:
space:
mode:
authorKurt Borja <[email protected]>2025-01-16 00:27:04 +0000
committerIlpo Järvinen <[email protected]>2025-01-16 15:26:25 +0000
commit249c576f0f9d0556cb7473b8a437b30239afbd16 (patch)
tree32144fa48c6617078a540b46df5f899e2c7ef084 /drivers/acpi/platform_profile.c
parentACPI: platform_profile: Replace *class_dev member with class_dev (diff)
downloadkernel-249c576f0f9d0556cb7473b8a437b30239afbd16.tar.gz
kernel-249c576f0f9d0556cb7473b8a437b30239afbd16.zip
ACPI: platform_profile: Let drivers set drvdata to the class device
Add *drvdata to platform_profile_register() signature and assign it to the class device. While at it, pass specific driver state as drvdata to replace uses of container_of() with dev_get_drvdata(). 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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
index 15f24adc57d4..689541d2e66c 100644
--- a/drivers/acpi/platform_profile.c
+++ b/drivers/acpi/platform_profile.c
@@ -460,7 +460,7 @@ int platform_profile_cycle(void)
}
EXPORT_SYMBOL_GPL(platform_profile_cycle);
-int platform_profile_register(struct platform_profile_handler *pprof)
+int platform_profile_register(struct platform_profile_handler *pprof, void *drvdata)
{
int err;
@@ -480,6 +480,7 @@ int platform_profile_register(struct platform_profile_handler *pprof)
pprof->class_dev.class = &platform_profile_class;
pprof->class_dev.parent = pprof->dev;
+ dev_set_drvdata(&pprof->class_dev, drvdata);
dev_set_name(&pprof->class_dev, "platform-profile-%d", pprof->minor);
err = device_register(&pprof->class_dev);
if (err) {
@@ -529,7 +530,7 @@ static void devm_platform_profile_release(struct device *dev, void *res)
platform_profile_remove(*pprof);
}
-int devm_platform_profile_register(struct platform_profile_handler *pprof)
+int devm_platform_profile_register(struct platform_profile_handler *pprof, void *drvdata)
{
struct platform_profile_handler **dr;
int ret;
@@ -538,7 +539,7 @@ int devm_platform_profile_register(struct platform_profile_handler *pprof)
if (!dr)
return -ENOMEM;
- ret = platform_profile_register(pprof);
+ ret = platform_profile_register(pprof, drvdata);
if (ret) {
devres_free(dr);
return ret;