Commit 27fec3cc authored by Raphael Gallais-Pou's avatar Raphael Gallais-Pou Committed by Daniel Lezcano

thermal/drivers/st: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()

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: default avatarPatrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: default avatarRaphael Gallais-Pou <rgallaispou@gmail.com>
Link: https://lore.kernel.org/r/20240716-thermal-v4-1-947b327e165c@gmail.comSigned-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent 77545bdf
...@@ -236,7 +236,6 @@ void st_thermal_unregister(struct platform_device *pdev) ...@@ -236,7 +236,6 @@ void st_thermal_unregister(struct platform_device *pdev)
} }
EXPORT_SYMBOL_GPL(st_thermal_unregister); EXPORT_SYMBOL_GPL(st_thermal_unregister);
#ifdef CONFIG_PM_SLEEP
static int st_thermal_suspend(struct device *dev) static int st_thermal_suspend(struct device *dev)
{ {
struct st_thermal_sensor *sensor = dev_get_drvdata(dev); struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
...@@ -265,9 +264,8 @@ static int st_thermal_resume(struct device *dev) ...@@ -265,9 +264,8 @@ static int st_thermal_resume(struct device *dev)
return 0; 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); EXPORT_SYMBOL_GPL(st_thermal_pm_ops);
MODULE_AUTHOR("STMicroelectronics (R&D) Limited <ajitpal.singh@st.com>"); MODULE_AUTHOR("STMicroelectronics (R&D) Limited <ajitpal.singh@st.com>");
......
...@@ -170,7 +170,7 @@ static void st_mmap_remove(struct platform_device *pdev) ...@@ -170,7 +170,7 @@ static void st_mmap_remove(struct platform_device *pdev)
static struct platform_driver st_mmap_thermal_driver = { static struct platform_driver st_mmap_thermal_driver = {
.driver = { .driver = {
.name = "st_thermal_mmap", .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, .of_match_table = st_mmap_thermal_of_match,
}, },
.probe = st_mmap_probe, .probe = st_mmap_probe,
......
...@@ -440,7 +440,6 @@ static int stm_thermal_prepare(struct stm_thermal_sensor *sensor) ...@@ -440,7 +440,6 @@ static int stm_thermal_prepare(struct stm_thermal_sensor *sensor)
return ret; return ret;
} }
#ifdef CONFIG_PM_SLEEP
static int stm_thermal_suspend(struct device *dev) static int stm_thermal_suspend(struct device *dev)
{ {
struct stm_thermal_sensor *sensor = dev_get_drvdata(dev); struct stm_thermal_sensor *sensor = dev_get_drvdata(dev);
...@@ -466,9 +465,8 @@ static int stm_thermal_resume(struct device *dev) ...@@ -466,9 +465,8 @@ static int stm_thermal_resume(struct device *dev)
return 0; return 0;
} }
#endif /* CONFIG_PM_SLEEP */
static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops, static DEFINE_SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
stm_thermal_suspend, stm_thermal_resume); stm_thermal_suspend, stm_thermal_resume);
static const struct thermal_zone_device_ops stm_tz_ops = { static const struct thermal_zone_device_ops stm_tz_ops = {
...@@ -580,7 +578,7 @@ static void stm_thermal_remove(struct platform_device *pdev) ...@@ -580,7 +578,7 @@ static void stm_thermal_remove(struct platform_device *pdev)
static struct platform_driver stm_thermal_driver = { static struct platform_driver stm_thermal_driver = {
.driver = { .driver = {
.name = "stm_thermal", .name = "stm_thermal",
.pm = &stm_thermal_pm_ops, .pm = pm_sleep_ptr(&stm_thermal_pm_ops),
.of_match_table = stm_thermal_of_match, .of_match_table = stm_thermal_of_match,
}, },
.probe = stm_thermal_probe, .probe = stm_thermal_probe,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment