thermal: hisi_termal: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
authorHesham Almatary <hesham.almatary@huawei.com>
Thu, 24 Mar 2022 10:34:43 +0000 (10:34 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 13 Apr 2022 14:37:28 +0000 (16:37 +0200)
Cleaning up the driver to use pm_sleep_ptr() macro instead of #ifdef
guards is simpler and allows the compiler to remove those functions
if built without CONFIG_PM_SLEEP support.

Signed-off-by: Hesham Almatary <hesham.almatary@huawei.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/hisi_thermal.c

index 9a21ac0ceb1124ebc1be16a6f5b4e272b228447b..b29ab09040d51591dd75fef43e0f062b2df3c9b9 100644 (file)
@@ -629,7 +629,6 @@ static int hisi_thermal_remove(struct platform_device *pdev)
        return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int hisi_thermal_suspend(struct device *dev)
 {
        struct hisi_thermal_data *data = dev_get_drvdata(dev);
@@ -651,15 +650,14 @@ static int hisi_thermal_resume(struct device *dev)
 
        return ret;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops,
+static DEFINE_SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops,
                         hisi_thermal_suspend, hisi_thermal_resume);
 
 static struct platform_driver hisi_thermal_driver = {
        .driver = {
                .name           = "hisi_thermal",
-               .pm             = &hisi_thermal_pm_ops,
+               .pm             = pm_sleep_ptr(&hisi_thermal_pm_ops),
                .of_match_table = of_hisi_thermal_match,
        },
        .probe  = hisi_thermal_probe,