Skip to content

Commit 27fec3c

Browse files
GallaisPoutinedlezcano
authored andcommitted
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: Patrice Chotard <[email protected]> Signed-off-by: Raphael Gallais-Pou <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent 77545bd commit 27fec3c

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

drivers/thermal/st/st_thermal.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ void st_thermal_unregister(struct platform_device *pdev)
236236
}
237237
EXPORT_SYMBOL_GPL(st_thermal_unregister);
238238

239-
#ifdef CONFIG_PM_SLEEP
240239
static int st_thermal_suspend(struct device *dev)
241240
{
242241
struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
@@ -265,9 +264,8 @@ static int st_thermal_resume(struct device *dev)
265264

266265
return 0;
267266
}
268-
#endif
269267

270-
SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume);
268+
DEFINE_SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume);
271269
EXPORT_SYMBOL_GPL(st_thermal_pm_ops);
272270

273271
MODULE_AUTHOR("STMicroelectronics (R&D) Limited <[email protected]>");

drivers/thermal/st/st_thermal_memmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static void st_mmap_remove(struct platform_device *pdev)
170170
static struct platform_driver st_mmap_thermal_driver = {
171171
.driver = {
172172
.name = "st_thermal_mmap",
173-
.pm = &st_thermal_pm_ops,
173+
.pm = pm_sleep_ptr(&st_thermal_pm_ops),
174174
.of_match_table = st_mmap_thermal_of_match,
175175
},
176176
.probe = st_mmap_probe,

drivers/thermal/st/stm_thermal.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ static int stm_thermal_prepare(struct stm_thermal_sensor *sensor)
440440
return ret;
441441
}
442442

443-
#ifdef CONFIG_PM_SLEEP
444443
static int stm_thermal_suspend(struct device *dev)
445444
{
446445
struct stm_thermal_sensor *sensor = dev_get_drvdata(dev);
@@ -466,10 +465,9 @@ static int stm_thermal_resume(struct device *dev)
466465

467466
return 0;
468467
}
469-
#endif /* CONFIG_PM_SLEEP */
470468

471-
static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
472-
stm_thermal_suspend, stm_thermal_resume);
469+
static DEFINE_SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
470+
stm_thermal_suspend, stm_thermal_resume);
473471

474472
static const struct thermal_zone_device_ops stm_tz_ops = {
475473
.get_temp = stm_thermal_get_temp,
@@ -580,7 +578,7 @@ static void stm_thermal_remove(struct platform_device *pdev)
580578
static struct platform_driver stm_thermal_driver = {
581579
.driver = {
582580
.name = "stm_thermal",
583-
.pm = &stm_thermal_pm_ops,
581+
.pm = pm_sleep_ptr(&stm_thermal_pm_ops),
584582
.of_match_table = stm_thermal_of_match,
585583
},
586584
.probe = stm_thermal_probe,

0 commit comments

Comments
 (0)