Skip to content

Commit 87b674b

Browse files
committed
platform/x86: asus-wmi: Use devm_platform_profile_register()
JIRA: https://issues.redhat.com/browse/RHEL-89362 commit 8f18685 Author: Kurt Borja <kuurtb@gmail.com> Date: Wed Jan 15 19:27:11 2025 -0500 Replace platform_profile_register() with it's device managed version. Also replace pr_err with dev_err in case of error and make the error message more user-friendly. 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-10-kuurtb@gmail.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
1 parent e18b3a2 commit 87b674b

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/platform/x86/asus-wmi.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3895,12 +3895,9 @@ static int platform_profile_setup(struct asus_wmi *asus)
38953895
asus->platform_profile_handler.dev = dev;
38963896
asus->platform_profile_handler.ops = &asus_wmi_platform_profile_ops;
38973897

3898-
err = platform_profile_register(&asus->platform_profile_handler, asus);
3899-
if (err == -EEXIST) {
3900-
pr_warn("%s, a platform_profile handler is already registered\n", __func__);
3901-
return 0;
3902-
} else if (err) {
3903-
pr_err("%s, failed at platform_profile_register: %d\n", __func__, err);
3898+
err = devm_platform_profile_register(&asus->platform_profile_handler, asus);
3899+
if (err) {
3900+
dev_err(dev, "Failed to register a platform_profile class device\n");
39043901
return err;
39053902
}
39063903

@@ -4859,8 +4856,6 @@ static int asus_wmi_add(struct platform_device *pdev)
48594856
fail_sysfs:
48604857
fail_custom_fan_curve:
48614858
fail_platform_profile_setup:
4862-
if (asus->platform_profile_support)
4863-
platform_profile_remove(&asus->platform_profile_handler);
48644859
fail_fan_boost_mode:
48654860
fail_platform:
48664861
kfree(asus);
@@ -4886,9 +4881,6 @@ static void asus_wmi_remove(struct platform_device *device)
48864881
throttle_thermal_policy_set_default(asus);
48874882
asus_wmi_battery_exit(asus);
48884883

4889-
if (asus->platform_profile_support)
4890-
platform_profile_remove(&asus->platform_profile_handler);
4891-
48924884
kfree(asus);
48934885
}
48944886

0 commit comments

Comments
 (0)