From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
Russell King - ARM Linux <linux@armlinux.org.uk>,
Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
David Miller <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Bjorn Andersson <andersson@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Vinod Koul <vkoul@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>,
linux-clk@vger.kernel.org, linux-phy@lists.infradead.org
Subject: [PATCH v2 net-next 4/5] net: phy: move registering mdio_bus_class and mdio_bus_type to libphy
Date: Mon, 9 Mar 2026 18:04:46 +0100 [thread overview]
Message-ID: <b15b378a-fda2-44b9-9d63-bf82919b71b2@gmail.com> (raw)
In-Reply-To: <9d5724bc-e525-4f8f-b3f8-b16dd5a1164e@gmail.com>
The MDIO consumer side shouldn't register class and bus_type.
Therefore move this to libphy.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/mdio_bus.c | 23 -----------------------
drivers/net/phy/phy_device.c | 13 +++++++++++++
2 files changed, 13 insertions(+), 23 deletions(-)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index c9a495390d2..9fb47332602 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -905,28 +905,5 @@ const struct bus_type mdio_bus_type = {
};
EXPORT_SYMBOL(mdio_bus_type);
-static int __init mdio_bus_init(void)
-{
- int ret;
-
- ret = class_register(&mdio_bus_class);
- if (!ret) {
- ret = bus_register(&mdio_bus_type);
- if (ret)
- class_unregister(&mdio_bus_class);
- }
-
- return ret;
-}
-
-static void __exit mdio_bus_exit(void)
-{
- class_unregister(&mdio_bus_class);
- bus_unregister(&mdio_bus_type);
-}
-
-subsys_initcall(mdio_bus_init);
-module_exit(mdio_bus_exit);
-
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("MDIO bus/device layer");
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index d1cbcfc3d2a..0edff47478c 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -3913,6 +3913,14 @@ static int __init phy_init(void)
{
int rc;
+ rc = class_register(&mdio_bus_class);
+ if (rc)
+ return rc;
+
+ rc = bus_register(&mdio_bus_type);
+ if (rc)
+ goto err_class;
+
rtnl_lock();
ethtool_set_ethtool_phy_ops(&phy_ethtool_phy_ops);
phylib_register_stubs();
@@ -3941,6 +3949,9 @@ static int __init phy_init(void)
phylib_unregister_stubs();
ethtool_set_ethtool_phy_ops(NULL);
rtnl_unlock();
+ bus_unregister(&mdio_bus_type);
+err_class:
+ class_unregister(&mdio_bus_class);
return rc;
}
@@ -3953,6 +3964,8 @@ static void __exit phy_exit(void)
phylib_unregister_stubs();
ethtool_set_ethtool_phy_ops(NULL);
rtnl_unlock();
+ bus_unregister(&mdio_bus_type);
+ class_unregister(&mdio_bus_class);
}
subsys_initcall(phy_init);
--
2.53.0
next prev parent reply other threads:[~2026-03-09 17:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 17:01 [PATCH v2 net-next 0/5] net: phy: further decouple provider from consumer part Heiner Kallweit
2026-03-09 17:02 ` [PATCH v2 net-next 1/5] net: phy: move mdio_device reset handling functions in the code Heiner Kallweit
2026-03-09 17:03 ` [PATCH v2 net-next 2/5] net: phy: make mdio_device.c part of libphy Heiner Kallweit
2026-03-12 11:06 ` Paolo Abeni
2026-03-09 17:04 ` [PATCH v2 net-next 3/5] net: phy: move (of_)mdio_find_bus to mdio_bus_provider.c Heiner Kallweit
2026-03-09 17:04 ` Heiner Kallweit [this message]
2026-03-09 17:06 ` [PATCH v2 net-next 5/5] net: phy: move remaining provider code " Heiner Kallweit
2026-03-14 19:30 ` [PATCH v2 net-next 0/5] net: phy: further decouple provider from consumer part patchwork-bot+netdevbpf
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=b15b378a-fda2-44b9-9d63-bf82919b71b2@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andersson@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=mturquette@baylibre.com \
--cc=neil.armstrong@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=sboyd@kernel.org \
--cc=vkoul@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox