Skip to content

Commit 8f18685

Browse files
kuu-rtij-intel
authored andcommitted
platform/x86: asus-wmi: Use devm_platform_profile_register()
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 <[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]>
1 parent 3e6d0bf commit 8f18685

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)