diff options
| author | Heiner Kallweit <hkallweit1@gmail.com> | 2026-03-09 18:04:08 +0100 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-03-14 12:23:02 -0700 |
| commit | b69ceb387aca23126421ed676a312576cc3e0aee (patch) | |
| tree | 086be0e4bdafdc0949698ca251712005ec552a7f | |
| parent | 6df1459605cedd2112ebf660c77f42bb87d5c306 (diff) | |
| download | linux-next-b69ceb387aca23126421ed676a312576cc3e0aee.tar.gz linux-next-b69ceb387aca23126421ed676a312576cc3e0aee.zip | |
net: phy: move (of_)mdio_find_bus to mdio_bus_provider.c
Functionality outside libphy shouldn't access mdio_bus_class directly.
So move both functions to the provider side. This is a step towards
making mdio_bus_class private to libphy.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/b6161c64-68ac-4524-82ec-5b7d81b86dbc@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
| -rw-r--r-- | drivers/net/phy/mdio_bus.c | 44 | ||||
| -rw-r--r-- | drivers/net/phy/mdio_bus_provider.c | 44 |
2 files changed, 44 insertions, 44 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index a30c679feeca..c9a495390d26 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -276,50 +276,6 @@ const struct class mdio_bus_class = { }; EXPORT_SYMBOL_GPL(mdio_bus_class); -/** - * mdio_find_bus - Given the name of a mdiobus, find the mii_bus. - * @mdio_name: The name of a mdiobus. - * - * Return: a reference to the mii_bus, or NULL if none found. The - * embedded struct device will have its reference count incremented, - * and this must be put_deviced'ed once the bus is finished with. - */ -struct mii_bus *mdio_find_bus(const char *mdio_name) -{ - struct device *d; - - d = class_find_device_by_name(&mdio_bus_class, mdio_name); - return d ? to_mii_bus(d) : NULL; -} -EXPORT_SYMBOL(mdio_find_bus); - -#if IS_ENABLED(CONFIG_OF_MDIO) -/** - * of_mdio_find_bus - Given an mii_bus node, find the mii_bus. - * @mdio_bus_np: Pointer to the mii_bus. - * - * Return: a reference to the mii_bus, or NULL if none found. The - * embedded struct device will have its reference count incremented, - * and this must be put once the bus is finished with. - * - * Because the association of a device_node and mii_bus is made via - * of_mdiobus_register(), the mii_bus cannot be found before it is - * registered with of_mdiobus_register(). - * - */ -struct mii_bus *of_mdio_find_bus(struct device_node *mdio_bus_np) -{ - struct device *d; - - if (!mdio_bus_np) - return NULL; - - d = class_find_device_by_of_node(&mdio_bus_class, mdio_bus_np); - return d ? to_mii_bus(d) : NULL; -} -EXPORT_SYMBOL(of_mdio_find_bus); -#endif - static void mdiobus_stats_acct(struct mdio_bus_stats *stats, bool op, int ret) { preempt_disable(); diff --git a/drivers/net/phy/mdio_bus_provider.c b/drivers/net/phy/mdio_bus_provider.c index 4b0637405740..d50fe6eb4b02 100644 --- a/drivers/net/phy/mdio_bus_provider.c +++ b/drivers/net/phy/mdio_bus_provider.c @@ -440,3 +440,47 @@ void mdiobus_free(struct mii_bus *bus) put_device(&bus->dev); } EXPORT_SYMBOL(mdiobus_free); + +/** + * mdio_find_bus - Given the name of a mdiobus, find the mii_bus. + * @mdio_name: The name of a mdiobus. + * + * Return: a reference to the mii_bus, or NULL if none found. The + * embedded struct device will have its reference count incremented, + * and this must be put_deviced'ed once the bus is finished with. + */ +struct mii_bus *mdio_find_bus(const char *mdio_name) +{ + struct device *d; + + d = class_find_device_by_name(&mdio_bus_class, mdio_name); + return d ? to_mii_bus(d) : NULL; +} +EXPORT_SYMBOL(mdio_find_bus); + +#if IS_ENABLED(CONFIG_OF_MDIO) +/** + * of_mdio_find_bus - Given an mii_bus node, find the mii_bus. + * @mdio_bus_np: Pointer to the mii_bus. + * + * Return: a reference to the mii_bus, or NULL if none found. The + * embedded struct device will have its reference count incremented, + * and this must be put once the bus is finished with. + * + * Because the association of a device_node and mii_bus is made via + * of_mdiobus_register(), the mii_bus cannot be found before it is + * registered with of_mdiobus_register(). + * + */ +struct mii_bus *of_mdio_find_bus(struct device_node *mdio_bus_np) +{ + struct device *d; + + if (!mdio_bus_np) + return NULL; + + d = class_find_device_by_of_node(&mdio_bus_class, mdio_bus_np); + return d ? to_mii_bus(d) : NULL; +} +EXPORT_SYMBOL(of_mdio_find_bus); +#endif |
