Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: mxs: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()

Replace SET_RUNTIME_PM_OPS()/SET SYSTEM_SLEEP_PM_OPS() with their modern
RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() alternatives.

The combined usage of pm_ptr() and RUNTIME_PM_OPS/SYSTEM_SLEEP_PM_OPS()
allows the compiler to evaluate if the runtime suspend/resume() functions
are used at build time or are simply dead code.

This allows removing the __maybe_unused annotations from the
suspend/resume() functions.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Link: https://patch.msgid.link/20240902184655.932699-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Fabio Estevam and committed by
Mark Brown
02774b14 bf62a8c7

+5 -6
+5 -6
drivers/spi/spi-mxs.c
··· 477 477 return ret; 478 478 } 479 479 480 - static int __maybe_unused mxs_spi_suspend(struct device *dev) 480 + static int mxs_spi_suspend(struct device *dev) 481 481 { 482 482 struct spi_controller *host = dev_get_drvdata(dev); 483 483 int ret; ··· 492 492 return 0; 493 493 } 494 494 495 - static int __maybe_unused mxs_spi_resume(struct device *dev) 495 + static int mxs_spi_resume(struct device *dev) 496 496 { 497 497 struct spi_controller *host = dev_get_drvdata(dev); 498 498 int ret; ··· 512 512 } 513 513 514 514 static const struct dev_pm_ops mxs_spi_pm = { 515 - SET_RUNTIME_PM_OPS(mxs_spi_runtime_suspend, 516 - mxs_spi_runtime_resume, NULL) 517 - SET_SYSTEM_SLEEP_PM_OPS(mxs_spi_suspend, mxs_spi_resume) 515 + RUNTIME_PM_OPS(mxs_spi_runtime_suspend, mxs_spi_runtime_resume, NULL) 516 + SYSTEM_SLEEP_PM_OPS(mxs_spi_suspend, mxs_spi_resume) 518 517 }; 519 518 520 519 static const struct of_device_id mxs_spi_dt_ids[] = { ··· 661 662 .driver = { 662 663 .name = DRIVER_NAME, 663 664 .of_match_table = mxs_spi_dt_ids, 664 - .pm = &mxs_spi_pm, 665 + .pm = pm_ptr(&mxs_spi_pm), 665 666 }, 666 667 }; 667 668