Use DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() instead of the deprecated SIMPLE_DEV_PM_OPS() and pm_ptr() macros for mdio_bus_phy_pm_ops. This allows the compiler to drop mdio_bus_phy_suspend(), mdio_bus_phy_resume() and mdio_bus_phy_pm_ops when CONFIG_PM_SLEEP is disabled, without needing __maybe_unused annotations. Signed-off-by: Artem Shimko <a.sh…@yadro.com> --- Hello, Compile-tested with CONFIG_PM_SLEEP=y and CONFIG_PM_SLEEP=n. Now after compilation the .pm struct will look like NULL field one in case of CONFIG_PM_SLEEP=n and we can remove __maybe_unused from mdio_bus_phy_suspend() and mdio_bus_phy_resume(). Thank you. Best regards, artem drivers/net/phy/phy_device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 60440b62e6c7..4730105b15f1 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -332,7 +332,7 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) return !phydev->suspended; } -static __maybe_unused int mdio_bus_phy_suspend(struct device *dev) +static int mdio_bus_phy_suspend(struct device *dev) { struct phy_device *phydev = to_phy_device(dev); @@ -364,7 +364,7 @@ static __maybe_unused int mdio_bus_phy_suspend(struct device *dev) return phy_suspend(phydev); } -static __maybe_unused int mdio_bus_phy_resume(struct device *dev) +static int mdio_bus_phy_resume(struct device *dev) { struct phy_device *phydev = to_phy_device(dev); int ret; @@ -413,7 +413,7 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(mdio_bus_phy_pm_ops, mdio_bus_phy_suspend, +static DEFINE_SIMPLE_DEV_PM_OPS(mdio_bus_phy_pm_ops, mdio_bus_phy_suspend, mdio_bus_phy_resume); /** @@ -632,7 +632,7 @@ static const struct device_type mdio_bus_phy_type = { .name = "PHY", .groups = phy_device_groups, .release = phy_device_release, - .pm = pm_ptr(&mdio_bus_phy_pm_ops), + .pm = pm_sleep_ptr(&mdio_bus_phy_pm_ops), }; static int phy_request_driver_module(struct phy_device *dev, u32 phy_id)
-- 2.43.0