From: Artem Shimko <a.shimko.dev@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Artem Shimko <a.shimko.dev@gmail.com>, netdev@vger.kernel.org
Subject: [PATCH net-next v2] net: phy: convert mdio_bus_phy_pm_ops to DEFINE_SIMPLE_DEV_PM_OPS()
Date: Sat, 5 Dec 2026 12:45:54 +0300 [thread overview]
Message-ID: <20261205094555.3247270-1-a.shimko.dev@gmail.com> (raw)
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
reply other threads:[~2026-12-05 9:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261205094555.3247270-1-a.shimko.dev@gmail.com \
--to=a.shimko.dev@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.