Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v2] net: phy: convert mdio_bus_phy_pm_ops to DEFINE_SIMPLE_DEV_PM_OPS()
@ 2026-12-05  9:45 Artem Shimko
  0 siblings, 0 replies; only message in thread
From: Artem Shimko @ 2026-12-05  9:45 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Artem Shimko, netdev

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.shimko.dev@gmail.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

ChangeLog:
  v2:
    * Rebase onto latest net-next.

 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-05  9:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05  9:45 [PATCH net-next v2] net: phy: convert mdio_bus_phy_pm_ops to DEFINE_SIMPLE_DEV_PM_OPS() Artem Shimko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox