spi: img-spfi: use modern PM macros

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 <jszhang@kernel.org>
Link: https://patch.msgid.link/20260803142003.12857-17-jszhang@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Jisheng Zhang 2026-08-03 22:19:40 +08:00 committed by Mark Brown
parent 527adbf1a1
commit 88672e90a9
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -677,7 +677,6 @@ static void img_spfi_remove(struct platform_device *pdev)
}
}
#ifdef CONFIG_PM
static int img_spfi_runtime_suspend(struct device *dev)
{
struct spi_controller *host = dev_get_drvdata(dev);
@ -706,9 +705,7 @@ static int img_spfi_runtime_resume(struct device *dev)
return 0;
}
#endif /* CONFIG_PM */
#ifdef CONFIG_PM_SLEEP
static int img_spfi_suspend(struct device *dev)
{
struct spi_controller *host = dev_get_drvdata(dev);
@ -730,12 +727,10 @@ static int img_spfi_resume(struct device *dev)
return spi_controller_resume(host);
}
#endif /* CONFIG_PM_SLEEP */
static const struct dev_pm_ops img_spfi_pm_ops = {
SET_RUNTIME_PM_OPS(img_spfi_runtime_suspend, img_spfi_runtime_resume,
NULL)
SET_SYSTEM_SLEEP_PM_OPS(img_spfi_suspend, img_spfi_resume)
RUNTIME_PM_OPS(img_spfi_runtime_suspend, img_spfi_runtime_resume, NULL)
SYSTEM_SLEEP_PM_OPS(img_spfi_suspend, img_spfi_resume)
};
static const struct of_device_id img_spfi_of_match[] = {
@ -747,7 +742,7 @@ MODULE_DEVICE_TABLE(of, img_spfi_of_match);
static struct platform_driver img_spfi_driver = {
.driver = {
.name = "img-spfi",
.pm = &img_spfi_pm_ops,
.pm = pm_ptr(&img_spfi_pm_ops),
.of_match_table = of_match_ptr(img_spfi_of_match),
},
.probe = img_spfi_probe,