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 --- drivers/net/phy/mdio_bus.c | 44 ----------------------------- 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 a30c679feec..c9a495390d2 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 4b063740574..d50fe6eb4b0 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 -- 2.53.0