Skip to content

Commit 6e702e6

Browse files
GallaisPoutinekuba-moo
authored andcommitted
net: stmmac: sti: 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]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Yanteng Si <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a4b6539 commit 6e702e6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ static void sti_dwmac_remove(struct platform_device *pdev)
313313
clk_disable_unprepare(dwmac->clk);
314314
}
315315

316-
#ifdef CONFIG_PM_SLEEP
317316
static int sti_dwmac_suspend(struct device *dev)
318317
{
319318
struct sti_dwmac *dwmac = get_stmmac_bsp_priv(dev);
@@ -333,10 +332,9 @@ static int sti_dwmac_resume(struct device *dev)
333332

334333
return stmmac_resume(dev);
335334
}
336-
#endif /* CONFIG_PM_SLEEP */
337335

338-
static SIMPLE_DEV_PM_OPS(sti_dwmac_pm_ops, sti_dwmac_suspend,
339-
sti_dwmac_resume);
336+
static DEFINE_SIMPLE_DEV_PM_OPS(sti_dwmac_pm_ops, sti_dwmac_suspend,
337+
sti_dwmac_resume);
340338

341339
static const struct sti_dwmac_of_data stih4xx_dwmac_data = {
342340
.fix_retime_src = stih4xx_fix_retime_src,
@@ -353,7 +351,7 @@ static struct platform_driver sti_dwmac_driver = {
353351
.remove = sti_dwmac_remove,
354352
.driver = {
355353
.name = "sti-dwmac",
356-
.pm = &sti_dwmac_pm_ops,
354+
.pm = pm_sleep_ptr(&sti_dwmac_pm_ops),
357355
.of_match_table = sti_dwmac_match,
358356
},
359357
};

0 commit comments

Comments
 (0)