From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>
Subject: [PATCH net-next v1 1/5] net: mdiobus: Provide fwnode_mdiobus_register()
Date: Mon, 4 May 2026 09:29:52 +0200 [thread overview]
Message-ID: <20260504074610.40799-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20260504074610.40799-1-andriy.shevchenko@linux.intel.com>
Provide an agnostic helper to register MDIO bus independently on
the firmware node provider.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/net/mdio/fwnode_mdio.c | 15 +++++++++++++++
include/linux/fwnode_mdio.h | 17 +++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c
index ba7091518265..7541df43ba6d 100644
--- a/drivers/net/mdio/fwnode_mdio.c
+++ b/drivers/net/mdio/fwnode_mdio.c
@@ -7,9 +7,11 @@
*/
#include <linux/acpi.h>
+#include <linux/acpi_mdio.h>
#include <linux/dev_printk.h>
#include <linux/fwnode_mdio.h>
#include <linux/of.h>
+#include <linux/of_mdio.h>
#include <linux/phy.h>
#include <linux/pse-pd/pse.h>
@@ -187,3 +189,16 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
return rc;
}
EXPORT_SYMBOL(fwnode_mdiobus_register_phy);
+
+int __fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode,
+ struct module *owner)
+{
+ if (is_of_node(fwnode))
+ return __of_mdiobus_register(mdio, to_of_node(fwnode), owner);
+
+ if (is_acpi_node(fwnode))
+ return __acpi_mdiobus_register(mdio, fwnode, owner);
+
+ return mdiobus_register(mdio);
+}
+EXPORT_SYMBOL(__fwnode_mdiobus_register);
diff --git a/include/linux/fwnode_mdio.h b/include/linux/fwnode_mdio.h
index faf603c48c86..c316b738333a 100644
--- a/include/linux/fwnode_mdio.h
+++ b/include/linux/fwnode_mdio.h
@@ -16,6 +16,14 @@ 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 *mdio, struct fwnode_handle *fwnode,
+ struct module *owner);
+
+static inline int
+fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
+{
+ return __fwnode_mdiobus_register(mdio, fwnode, THIS_MODULE);
+}
#else /* CONFIG_FWNODE_MDIO */
int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
struct phy_device *phy,
@@ -30,6 +38,15 @@ static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus,
{
return -EINVAL;
}
+
+static inline int fwnode_mdiobus_register(struct mii_bus *mdio, 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 */
--
2.50.1
next prev parent reply other threads:[~2026-05-04 7:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 7:29 [PATCH net-next v1 0/5] net: mdiobus: HIde ACPI implementation Andy Shevchenko
2026-05-04 7:29 ` Andy Shevchenko [this message]
2026-05-04 7:29 ` [PATCH net-next v1 2/5] net: mvmdio: Switch to using fwnode_mdiobus_register() Andy Shevchenko
2026-05-04 7:29 ` [PATCH net-next v1 3/5] net/fsl: xgmac_mdio: " Andy Shevchenko
2026-05-04 7:29 ` [PATCH net-next v1 4/5] net/fsl: xgmac_mdio: Reuse existing pointer to fwnode Andy Shevchenko
2026-05-04 7:29 ` [PATCH net-next v1 5/5] net: mdiobus: Hide acpi_mdio.h Andy Shevchenko
2026-05-04 13:02 ` [PATCH net-next v1 0/5] net: mdiobus: HIde ACPI implementation Andrew Lunn
2026-05-04 13:49 ` Andy Shevchenko
2026-05-04 15:16 ` Andrew Lunn
2026-05-05 4:54 ` Andy Shevchenko
-- strict thread matches above, loose matches on Subject: below --
2026-05-04 14:16 [PATCH net-next v1 1/5] net: mdiobus: Provide fwnode_mdiobus_register() Victor Nogueira
2026-05-04 14:41 ` Andy Shevchenko
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=20260504074610.40799-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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