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

mtd: st_spi_fsm: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

authored by

Raphael Gallais-Pou and committed by
Miquel Raynal
29b94158 bf582190

+2 -4
+2 -4
drivers/mtd/devices/st_spi_fsm.c
··· 2104 2104 WARN_ON(mtd_device_unregister(&fsm->mtd)); 2105 2105 } 2106 2106 2107 - #ifdef CONFIG_PM_SLEEP 2108 2107 static int stfsmfsm_suspend(struct device *dev) 2109 2108 { 2110 2109 struct stfsm *fsm = dev_get_drvdata(dev); ··· 2119 2120 2120 2121 return clk_prepare_enable(fsm->clk); 2121 2122 } 2122 - #endif 2123 2123 2124 - static SIMPLE_DEV_PM_OPS(stfsm_pm_ops, stfsmfsm_suspend, stfsmfsm_resume); 2124 + static DEFINE_SIMPLE_DEV_PM_OPS(stfsm_pm_ops, stfsmfsm_suspend, stfsmfsm_resume); 2125 2125 2126 2126 static const struct of_device_id stfsm_match[] = { 2127 2127 { .compatible = "st,spi-fsm", }, ··· 2134 2136 .driver = { 2135 2137 .name = "st-spi-fsm", 2136 2138 .of_match_table = stfsm_match, 2137 - .pm = &stfsm_pm_ops, 2139 + .pm = pm_sleep_ptr(&stfsm_pm_ops), 2138 2140 }, 2139 2141 }; 2140 2142 module_platform_driver(stfsm_driver);