Commit de6c7b9a authored by Fabio Estevam's avatar Fabio Estevam Committed by Jakub Kicinski

net: fec: 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 notation from the runtime
suspend/resume() functions.
Signed-off-by: default avatarFabio Estevam <festevam@denx.de>
Reviewed-by: default avatarPeng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20240806021628.2524089-1-festevam@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3f49edf4
...@@ -4606,7 +4606,7 @@ fec_drv_remove(struct platform_device *pdev) ...@@ -4606,7 +4606,7 @@ fec_drv_remove(struct platform_device *pdev)
free_netdev(ndev); free_netdev(ndev);
} }
static int __maybe_unused fec_suspend(struct device *dev) static int fec_suspend(struct device *dev)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = dev_get_drvdata(dev);
struct fec_enet_private *fep = netdev_priv(ndev); struct fec_enet_private *fep = netdev_priv(ndev);
...@@ -4659,7 +4659,7 @@ static int __maybe_unused fec_suspend(struct device *dev) ...@@ -4659,7 +4659,7 @@ static int __maybe_unused fec_suspend(struct device *dev)
return 0; return 0;
} }
static int __maybe_unused fec_resume(struct device *dev) static int fec_resume(struct device *dev)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = dev_get_drvdata(dev);
struct fec_enet_private *fep = netdev_priv(ndev); struct fec_enet_private *fep = netdev_priv(ndev);
...@@ -4714,7 +4714,7 @@ static int __maybe_unused fec_resume(struct device *dev) ...@@ -4714,7 +4714,7 @@ static int __maybe_unused fec_resume(struct device *dev)
return ret; return ret;
} }
static int __maybe_unused fec_runtime_suspend(struct device *dev) static int fec_runtime_suspend(struct device *dev)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = dev_get_drvdata(dev);
struct fec_enet_private *fep = netdev_priv(ndev); struct fec_enet_private *fep = netdev_priv(ndev);
...@@ -4725,7 +4725,7 @@ static int __maybe_unused fec_runtime_suspend(struct device *dev) ...@@ -4725,7 +4725,7 @@ static int __maybe_unused fec_runtime_suspend(struct device *dev)
return 0; return 0;
} }
static int __maybe_unused fec_runtime_resume(struct device *dev) static int fec_runtime_resume(struct device *dev)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = dev_get_drvdata(dev);
struct fec_enet_private *fep = netdev_priv(ndev); struct fec_enet_private *fep = netdev_priv(ndev);
...@@ -4746,14 +4746,14 @@ static int __maybe_unused fec_runtime_resume(struct device *dev) ...@@ -4746,14 +4746,14 @@ static int __maybe_unused fec_runtime_resume(struct device *dev)
} }
static const struct dev_pm_ops fec_pm_ops = { static const struct dev_pm_ops fec_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(fec_suspend, fec_resume) SYSTEM_SLEEP_PM_OPS(fec_suspend, fec_resume)
SET_RUNTIME_PM_OPS(fec_runtime_suspend, fec_runtime_resume, NULL) RUNTIME_PM_OPS(fec_runtime_suspend, fec_runtime_resume, NULL)
}; };
static struct platform_driver fec_driver = { static struct platform_driver fec_driver = {
.driver = { .driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.pm = &fec_pm_ops, .pm = pm_ptr(&fec_pm_ops),
.of_match_table = fec_dt_ids, .of_match_table = fec_dt_ids,
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment