From 10a6d7507791a667fe1d327056ac3f72934cc7de Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Tue, 6 Jan 2026 13:14:19 +0100 Subject: [PATCH] spi: stm32-qspi: 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 Link: https://patch.msgid.link/20260106-spi_st_maybe_unused_removal-v1-3-8f5ca7136e96@foss.st.com Signed-off-by: Mark Brown --- drivers/spi/spi-stm32-qspi.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c index f2d19f1c5ab1c..e7965be99bd95 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -891,7 +891,7 @@ static void stm32_qspi_remove(struct platform_device *pdev) clk_disable_unprepare(qspi->clk); } -static int __maybe_unused stm32_qspi_runtime_suspend(struct device *dev) +static int stm32_qspi_runtime_suspend(struct device *dev) { struct stm32_qspi *qspi = dev_get_drvdata(dev); @@ -900,21 +900,21 @@ static int __maybe_unused stm32_qspi_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused stm32_qspi_runtime_resume(struct device *dev) +static int stm32_qspi_runtime_resume(struct device *dev) { struct stm32_qspi *qspi = dev_get_drvdata(dev); return clk_prepare_enable(qspi->clk); } -static int __maybe_unused stm32_qspi_suspend(struct device *dev) +static int stm32_qspi_suspend(struct device *dev) { pinctrl_pm_select_sleep_state(dev); return pm_runtime_force_suspend(dev); } -static int __maybe_unused stm32_qspi_resume(struct device *dev) +static int stm32_qspi_resume(struct device *dev) { struct stm32_qspi *qspi = dev_get_drvdata(dev); int ret; @@ -938,9 +938,8 @@ static int __maybe_unused stm32_qspi_resume(struct device *dev) } static const struct dev_pm_ops stm32_qspi_pm_ops = { - SET_RUNTIME_PM_OPS(stm32_qspi_runtime_suspend, - stm32_qspi_runtime_resume, NULL) - SET_SYSTEM_SLEEP_PM_OPS(stm32_qspi_suspend, stm32_qspi_resume) + RUNTIME_PM_OPS(stm32_qspi_runtime_suspend, stm32_qspi_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(stm32_qspi_suspend, stm32_qspi_resume) }; static const struct of_device_id stm32_qspi_match[] = { @@ -955,7 +954,7 @@ static struct platform_driver stm32_qspi_driver = { .driver = { .name = "stm32-qspi", .of_match_table = stm32_qspi_match, - .pm = &stm32_qspi_pm_ops, + .pm = pm_ptr(&stm32_qspi_pm_ops), }, }; module_platform_driver(stm32_qspi_driver); -- 2.47.3