[PATCH 36/39] spi: tegra20-slink: use modern PM macros
From: Jisheng Zhang
Date: Mon Aug 03 2026 - 11:12:01 EST
Use the modern PM macros for the suspend and resume functions to be
automatically dropped by the compiler when CONFIG_PM or
CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards or
__maybe_unused.
This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.
Signed-off-by: Jisheng Zhang <jszhang@xxxxxxxxxx>
---
drivers/spi/spi-tegra20-slink.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index c15c076295cd..ed1fcf57dd30 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -1144,7 +1144,6 @@ static void tegra_slink_remove(struct platform_device *pdev)
tegra_slink_deinit_dma_param(tspi, true);
}
-#ifdef CONFIG_PM_SLEEP
static int tegra_slink_suspend(struct device *dev)
{
struct spi_controller *host = dev_get_drvdata(dev);
@@ -1169,9 +1168,8 @@ static int tegra_slink_resume(struct device *dev)
return spi_controller_resume(host);
}
-#endif
-static int __maybe_unused tegra_slink_runtime_suspend(struct device *dev)
+static int tegra_slink_runtime_suspend(struct device *dev)
{
struct spi_controller *host = dev_get_drvdata(dev);
struct tegra_slink_data *tspi = spi_controller_get_devdata(host);
@@ -1183,7 +1181,7 @@ static int __maybe_unused tegra_slink_runtime_suspend(struct device *dev)
return 0;
}
-static int __maybe_unused tegra_slink_runtime_resume(struct device *dev)
+static int tegra_slink_runtime_resume(struct device *dev)
{
struct spi_controller *host = dev_get_drvdata(dev);
struct tegra_slink_data *tspi = spi_controller_get_devdata(host);
@@ -1198,14 +1196,14 @@ static int __maybe_unused tegra_slink_runtime_resume(struct device *dev)
}
static const struct dev_pm_ops slink_pm_ops = {
- SET_RUNTIME_PM_OPS(tegra_slink_runtime_suspend,
- tegra_slink_runtime_resume, NULL)
- SET_SYSTEM_SLEEP_PM_OPS(tegra_slink_suspend, tegra_slink_resume)
+ RUNTIME_PM_OPS(tegra_slink_runtime_suspend,
+ tegra_slink_runtime_resume, NULL)
+ SYSTEM_SLEEP_PM_OPS(tegra_slink_suspend, tegra_slink_resume)
};
static struct platform_driver tegra_slink_driver = {
.driver = {
.name = "spi-tegra-slink",
- .pm = &slink_pm_ops,
+ .pm = pm_ptr(&slink_pm_ops),
.of_match_table = tegra_slink_of_match,
},
.probe = tegra_slink_probe,
--
2.53.0