[PATCH 35/39] spi: tegra20-sflash: use modern PM macros

Jisheng Zhang <[email protected]> Mon, 3 Aug 2026 22:19:59 +0800
Newsgroups org.kernel.vger.linux-spi,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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.

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 <[email protected]>
---
 drivers/spi/spi-tegra20-sflash.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
index 2caa33f0a52c..2a5e3acea06b 100644
--- a/drivers/spi/spi-tegra20-sflash.c
+++ b/drivers/spi/spi-tegra20-sflash.c
@@ -533,7 +533,6 @@ static void tegra_sflash_remove(struct platform_device *pdev)
 		tegra_sflash_runtime_suspend(&pdev->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int tegra_sflash_suspend(struct device *dev)
 {
 	struct spi_controller *host = dev_get_drvdata(dev);
@@ -557,7 +556,6 @@ static int tegra_sflash_resume(struct device *dev)
 
 	return spi_controller_resume(host);
 }
-#endif
 
 static int tegra_sflash_runtime_suspend(struct device *dev)
 {
@@ -586,14 +584,14 @@ static int tegra_sflash_runtime_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops slink_pm_ops = {
-	SET_RUNTIME_PM_OPS(tegra_sflash_runtime_suspend,
-		tegra_sflash_runtime_resume, NULL)
-	SET_SYSTEM_SLEEP_PM_OPS(tegra_sflash_suspend, tegra_sflash_resume)
+	RUNTIME_PM_OPS(tegra_sflash_runtime_suspend,
+		       tegra_sflash_runtime_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(tegra_sflash_suspend, tegra_sflash_resume)
 };
 static struct platform_driver tegra_sflash_driver = {
 	.driver = {
 		.name		= "spi-tegra-sflash",
-		.pm		= &slink_pm_ops,
+		.pm		= pm_ptr(&slink_pm_ops),
 		.of_match_table	= tegra_sflash_of_match,
 	},
 	.probe =	tegra_sflash_probe,
-- 
2.53.0