diff options
| author | Heiner Kallweit <hkallweit1@gmail.com> | 2026-03-09 20:04:46 +0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-03-14 22:23:02 +0300 |
| commit | 25b23d82831870b8581abe6a24970ffd95675bc7 (patch) | |
| tree | 5f4f9ecc1e86bd508f931643322b7896828f76a3 | |
| parent | b69ceb387aca23126421ed676a312576cc3e0aee (diff) | |
| download | linux-25b23d82831870b8581abe6a24970ffd95675bc7.tar.xz | |
net: phy: move registering mdio_bus_class and mdio_bus_type to libphy
The MDIO consumer side shouldn't register class and bus_type.
Therefore move this to libphy.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/b15b378a-fda2-44b9-9d63-bf82919b71b2@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
| -rw-r--r-- | drivers/net/phy/mdio_bus.c | 23 | ||||
| -rw-r--r-- | 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 c9a495390d26..9fb473326027 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 d1cbcfc3d2a6..0edff47478c2 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 @@ err_ethtool_phy_ops: 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); |
