summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarcin Wojtas <mw@semihalf.com>2021-06-21 20:30:24 +0300
committerDavid S. Miller <davem@davemloft.net>2021-06-22 19:54:55 +0300
commit62a6ef6a996f5eec73d30d079573a1fa8f95fcd9 (patch)
tree77e2a5483fbe97608e14a7948fb1ff7e9acf05a5 /include
parent7c4d7ca8cce3c8167e10f52a5afb553851f2086b (diff)
downloadlinux-62a6ef6a996f5eec73d30d079573a1fa8f95fcd9.tar.xz
net: mdiobus: Introduce fwnode_mdbiobus_register()
This patch introduces a new helper function that wraps acpi_/of_ mdiobus_register() and allows its usage via common fwnode_ interface. Fall back to raw mdiobus_register() in case CONFIG_FWNODE_MDIO is not enabled, in order to satisfy compatibility in all future user drivers. Signed-off-by: Marcin Wojtas <mw@semihalf.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fwnode_mdio.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/fwnode_mdio.h b/include/linux/fwnode_mdio.h
index faf603c48c86..13d4ae8fee0a 100644
--- a/include/linux/fwnode_mdio.h
+++ b/include/linux/fwnode_mdio.h
@@ -16,6 +16,7 @@ int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
int fwnode_mdiobus_register_phy(struct mii_bus *bus,
struct fwnode_handle *child, u32 addr);
+int fwnode_mdiobus_register(struct mii_bus *bus, struct fwnode_handle *fwnode);
#else /* CONFIG_FWNODE_MDIO */
int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
struct phy_device *phy,
@@ -30,6 +31,17 @@ static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus,
{
return -EINVAL;
}
+
+static inline int fwnode_mdiobus_register(struct mii_bus *bus,
+ struct fwnode_handle *fwnode)
+{
+ /*
+ * Fall back to mdiobus_register() function to register a bus.
+ * This way, we don't have to keep compat bits around in drivers.
+ */
+
+ return mdiobus_register(mdio);
+}
#endif
#endif /* __LINUX_FWNODE_MDIO_H */