Skip to content

Commit 29b9415

Browse files
GallaisPoutinemiquelraynal
authored andcommitted
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 <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
1 parent bf58219 commit 29b9415

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/mtd/devices/st_spi_fsm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,7 +2104,6 @@ static void stfsm_remove(struct platform_device *pdev)
21042104
WARN_ON(mtd_device_unregister(&fsm->mtd));
21052105
}
21062106

2107-
#ifdef CONFIG_PM_SLEEP
21082107
static int stfsmfsm_suspend(struct device *dev)
21092108
{
21102109
struct stfsm *fsm = dev_get_drvdata(dev);
@@ -2120,9 +2119,8 @@ static int stfsmfsm_resume(struct device *dev)
21202119

21212120
return clk_prepare_enable(fsm->clk);
21222121
}
2123-
#endif
21242122

2125-
static SIMPLE_DEV_PM_OPS(stfsm_pm_ops, stfsmfsm_suspend, stfsmfsm_resume);
2123+
static DEFINE_SIMPLE_DEV_PM_OPS(stfsm_pm_ops, stfsmfsm_suspend, stfsmfsm_resume);
21262124

21272125
static const struct of_device_id stfsm_match[] = {
21282126
{ .compatible = "st,spi-fsm", },
@@ -2136,7 +2134,7 @@ static struct platform_driver stfsm_driver = {
21362134
.driver = {
21372135
.name = "st-spi-fsm",
21382136
.of_match_table = stfsm_match,
2139-
.pm = &stfsm_pm_ops,
2137+
.pm = pm_sleep_ptr(&stfsm_pm_ops),
21402138
},
21412139
};
21422140
module_platform_driver(stfsm_driver);

0 commit comments

Comments
 (0)