]> git.itanic.dy.fi Git - linux-stable/commitdiff
thermal: amlogic: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 16 Nov 2023 11:26:36 +0000 (12:26 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 2 Jan 2024 08:33:18 +0000 (09:33 +0100)
This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
care about when the functions are actually used, so the corresponding
__maybe_unused can be dropped.

Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
isn't enabled.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20231116112633.668826-3-u.kleine-koenig@pengutronix.de
drivers/thermal/amlogic_thermal.c

index 562f63b7bf2795d4de0b82cca34f84f889756be2..df7a5ed55385ea07007fbc260b81ce44c9dfad40 100644 (file)
@@ -296,7 +296,7 @@ static void amlogic_thermal_remove(struct platform_device *pdev)
        amlogic_thermal_disable(data);
 }
 
-static int __maybe_unused amlogic_thermal_suspend(struct device *dev)
+static int amlogic_thermal_suspend(struct device *dev)
 {
        struct amlogic_thermal *data = dev_get_drvdata(dev);
 
@@ -305,20 +305,21 @@ static int __maybe_unused amlogic_thermal_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused amlogic_thermal_resume(struct device *dev)
+static int amlogic_thermal_resume(struct device *dev)
 {
        struct amlogic_thermal *data = dev_get_drvdata(dev);
 
        return amlogic_thermal_enable(data);
 }
 
-static SIMPLE_DEV_PM_OPS(amlogic_thermal_pm_ops,
-                        amlogic_thermal_suspend, amlogic_thermal_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(amlogic_thermal_pm_ops,
+                               amlogic_thermal_suspend,
+                               amlogic_thermal_resume);
 
 static struct platform_driver amlogic_thermal_driver = {
        .driver = {
                .name           = "amlogic_thermal",
-               .pm             = &amlogic_thermal_pm_ops,
+               .pm             = pm_ptr(&amlogic_thermal_pm_ops),
                .of_match_table = of_amlogic_thermal_match,
        },
        .probe = amlogic_thermal_probe,