Skip to content

Commit 6f8584a

Browse files
GallaisPoutinebroonie
authored andcommitted
spi: 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. Signed-off-by: Raphael Gallais-Pou <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 7d61715 commit 6f8584a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

drivers/spi/spi-st-ssc4.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,7 @@ static void spi_st_remove(struct platform_device *pdev)
378378
pinctrl_pm_select_sleep_state(&pdev->dev);
379379
}
380380

381-
#ifdef CONFIG_PM
382-
static int spi_st_runtime_suspend(struct device *dev)
381+
static int __maybe_unused spi_st_runtime_suspend(struct device *dev)
383382
{
384383
struct spi_controller *host = dev_get_drvdata(dev);
385384
struct spi_st *spi_st = spi_controller_get_devdata(host);
@@ -392,7 +391,7 @@ static int spi_st_runtime_suspend(struct device *dev)
392391
return 0;
393392
}
394393

395-
static int spi_st_runtime_resume(struct device *dev)
394+
static int __maybe_unused spi_st_runtime_resume(struct device *dev)
396395
{
397396
struct spi_controller *host = dev_get_drvdata(dev);
398397
struct spi_st *spi_st = spi_controller_get_devdata(host);
@@ -403,10 +402,8 @@ static int spi_st_runtime_resume(struct device *dev)
403402

404403
return ret;
405404
}
406-
#endif
407405

408-
#ifdef CONFIG_PM_SLEEP
409-
static int spi_st_suspend(struct device *dev)
406+
static int __maybe_unused spi_st_suspend(struct device *dev)
410407
{
411408
struct spi_controller *host = dev_get_drvdata(dev);
412409
int ret;
@@ -418,7 +415,7 @@ static int spi_st_suspend(struct device *dev)
418415
return pm_runtime_force_suspend(dev);
419416
}
420417

421-
static int spi_st_resume(struct device *dev)
418+
static int __maybe_unused spi_st_resume(struct device *dev)
422419
{
423420
struct spi_controller *host = dev_get_drvdata(dev);
424421
int ret;
@@ -429,7 +426,6 @@ static int spi_st_resume(struct device *dev)
429426

430427
return pm_runtime_force_resume(dev);
431428
}
432-
#endif
433429

434430
static const struct dev_pm_ops spi_st_pm = {
435431
SET_SYSTEM_SLEEP_PM_OPS(spi_st_suspend, spi_st_resume)
@@ -445,7 +441,7 @@ MODULE_DEVICE_TABLE(of, stm_spi_match);
445441
static struct platform_driver spi_st_driver = {
446442
.driver = {
447443
.name = "spi-st",
448-
.pm = &spi_st_pm,
444+
.pm = pm_sleep_ptr(&spi_st_pm),
449445
.of_match_table = of_match_ptr(stm_spi_match),
450446
},
451447
.probe = spi_st_probe,

0 commit comments

Comments
 (0)