Skip to content

Commit 75d208b

Browse files
Alain Volmatbroonie
authored andcommitted
spi: stm32: avoid __maybe_unused and use pm_ptr
Switch to usage of pm_ptr / SYSTEM_SLEEP_PM_OPS / RUNTIME_PM_OPS in order to avoid having to mark the pm related functions as __maybe_unused. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Link: https://patch.msgid.link/20260106-spi_st_maybe_unused_removal-v1-4-8f5ca7136e96@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 10a6d75 commit 75d208b

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

drivers/spi/spi-stm32.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,7 +2532,7 @@ static void stm32_spi_remove(struct platform_device *pdev)
25322532
pinctrl_pm_select_sleep_state(&pdev->dev);
25332533
}
25342534

2535-
static int __maybe_unused stm32_spi_runtime_suspend(struct device *dev)
2535+
static int stm32_spi_runtime_suspend(struct device *dev)
25362536
{
25372537
struct spi_controller *ctrl = dev_get_drvdata(dev);
25382538
struct stm32_spi *spi = spi_controller_get_devdata(ctrl);
@@ -2542,7 +2542,7 @@ static int __maybe_unused stm32_spi_runtime_suspend(struct device *dev)
25422542
return pinctrl_pm_select_sleep_state(dev);
25432543
}
25442544

2545-
static int __maybe_unused stm32_spi_runtime_resume(struct device *dev)
2545+
static int stm32_spi_runtime_resume(struct device *dev)
25462546
{
25472547
struct spi_controller *ctrl = dev_get_drvdata(dev);
25482548
struct stm32_spi *spi = spi_controller_get_devdata(ctrl);
@@ -2555,7 +2555,7 @@ static int __maybe_unused stm32_spi_runtime_resume(struct device *dev)
25552555
return clk_prepare_enable(spi->clk);
25562556
}
25572557

2558-
static int __maybe_unused stm32_spi_suspend(struct device *dev)
2558+
static int stm32_spi_suspend(struct device *dev)
25592559
{
25602560
struct spi_controller *ctrl = dev_get_drvdata(dev);
25612561
int ret;
@@ -2567,7 +2567,7 @@ static int __maybe_unused stm32_spi_suspend(struct device *dev)
25672567
return pm_runtime_force_suspend(dev);
25682568
}
25692569

2570-
static int __maybe_unused stm32_spi_resume(struct device *dev)
2570+
static int stm32_spi_resume(struct device *dev)
25712571
{
25722572
struct spi_controller *ctrl = dev_get_drvdata(dev);
25732573
struct stm32_spi *spi = spi_controller_get_devdata(ctrl);
@@ -2597,17 +2597,16 @@ static int __maybe_unused stm32_spi_resume(struct device *dev)
25972597
}
25982598

25992599
static const struct dev_pm_ops stm32_spi_pm_ops = {
2600-
SET_SYSTEM_SLEEP_PM_OPS(stm32_spi_suspend, stm32_spi_resume)
2601-
SET_RUNTIME_PM_OPS(stm32_spi_runtime_suspend,
2602-
stm32_spi_runtime_resume, NULL)
2600+
SYSTEM_SLEEP_PM_OPS(stm32_spi_suspend, stm32_spi_resume)
2601+
RUNTIME_PM_OPS(stm32_spi_runtime_suspend, stm32_spi_runtime_resume, NULL)
26032602
};
26042603

26052604
static struct platform_driver stm32_spi_driver = {
26062605
.probe = stm32_spi_probe,
26072606
.remove = stm32_spi_remove,
26082607
.driver = {
26092608
.name = DRIVER_NAME,
2610-
.pm = &stm32_spi_pm_ops,
2609+
.pm = pm_ptr(&stm32_spi_pm_ops),
26112610
.of_match_table = stm32_spi_of_match,
26122611
},
26132612
};

0 commit comments

Comments
 (0)