]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
thermal/drivers/st: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
authorRaphael Gallais-Pou <rgallaispou@gmail.com>
Tue, 16 Jul 2024 17:34:51 +0000 (19:34 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Mon, 2 Sep 2024 10:43:20 +0000 (12:43 +0200)
Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Remove those guards on every ST thermal related drivers.

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
Link: https://lore.kernel.org/r/20240716-thermal-v4-1-947b327e165c@gmail.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/thermal/st/st_thermal.c
drivers/thermal/st/st_thermal_memmap.c
drivers/thermal/st/stm_thermal.c

index 2a105409864ead390d8a57731240486f9b10b26a..5f33543a3a54c7e468c6d08c2800fccc6b9bae15 100644 (file)
@@ -236,7 +236,6 @@ void st_thermal_unregister(struct platform_device *pdev)
 }
 EXPORT_SYMBOL_GPL(st_thermal_unregister);
 
-#ifdef CONFIG_PM_SLEEP
 static int st_thermal_suspend(struct device *dev)
 {
        struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
@@ -265,9 +264,8 @@ static int st_thermal_resume(struct device *dev)
 
        return 0;
 }
-#endif
 
-SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume);
+DEFINE_SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume);
 EXPORT_SYMBOL_GPL(st_thermal_pm_ops);
 
 MODULE_AUTHOR("STMicroelectronics (R&D) Limited <ajitpal.singh@st.com>");
index e427117381a41000590327b59ac6c71823b82aee..97493d2b2f4999c929747ea1934397d41f103c4a 100644 (file)
@@ -170,7 +170,7 @@ static void st_mmap_remove(struct platform_device *pdev)
 static struct platform_driver st_mmap_thermal_driver = {
        .driver = {
                .name   = "st_thermal_mmap",
-               .pm     = &st_thermal_pm_ops,
+               .pm     = pm_sleep_ptr(&st_thermal_pm_ops),
                .of_match_table = st_mmap_thermal_of_match,
        },
        .probe          = st_mmap_probe,
index 34785b9276fc74b87c494171b4d892cbc5d4c832..ffd988600ed6a27732c8f8b7437c4c35fe200573 100644 (file)
@@ -440,7 +440,6 @@ thermal_unprepare:
        return ret;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stm_thermal_suspend(struct device *dev)
 {
        struct stm_thermal_sensor *sensor = dev_get_drvdata(dev);
@@ -466,10 +465,9 @@ static int stm_thermal_resume(struct device *dev)
 
        return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
-                        stm_thermal_suspend, stm_thermal_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
+                               stm_thermal_suspend, stm_thermal_resume);
 
 static const struct thermal_zone_device_ops stm_tz_ops = {
        .get_temp       = stm_thermal_get_temp,
@@ -580,7 +578,7 @@ static void stm_thermal_remove(struct platform_device *pdev)
 static struct platform_driver stm_thermal_driver = {
        .driver = {
                .name   = "stm_thermal",
-               .pm     = &stm_thermal_pm_ops,
+               .pm     = pm_sleep_ptr(&stm_thermal_pm_ops),
                .of_match_table = stm_thermal_of_match,
        },
        .probe          = stm_thermal_probe,