* Re: [PATCH net-next v1 1/5] net: mdiobus: Provide fwnode_mdiobus_register()
@ 2026-05-04 14:16 Victor Nogueira
2026-05-04 14:41 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Victor Nogueira @ 2026-05-04 14:16 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel, Linux Kernel Network Developers
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Heiner Kallweit, Russell King
Hi!
On 04/05/2026 04:29, Andy Shevchenko wrote:
> Provide an agnostic helper to register MDIO bus independently on
> the firmware node provider.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> [...]
> @@ -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);
Build seems to break when CONFIG_OF_MDIO is not defined:
drivers/net/mdio/fwnode_mdio.c: In function ‘__fwnode_mdiobus_register’:
drivers/net/mdio/fwnode_mdio.c:198:24: error: implicit declaration of
function ‘__of_mdiobus_register’; did you mean ‘of_mdiobus_register’?
[-Wimplicit-function-declaration]
198 | return __of_mdiobus_register(mdio,
to_of_node(fwnode), owner);
cheers,
Victor
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net-next v1 1/5] net: mdiobus: Provide fwnode_mdiobus_register()
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
0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2026-05-04 14:41 UTC (permalink / raw)
To: Victor Nogueira
Cc: linux-kernel, Linux Kernel Network Developers, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Heiner Kallweit, Russell King
On Mon, May 04, 2026 at 11:16:00AM -0300, Victor Nogueira wrote:
> On 04/05/2026 04:29, Andy Shevchenko wrote:
> > Provide an agnostic helper to register MDIO bus independently on
> > the firmware node provider.
[...]
> > + if (is_of_node(fwnode))
> > + return __of_mdiobus_register(mdio, to_of_node(fwnode), owner);
>
> Build seems to break when CONFIG_OF_MDIO is not defined:
>
> drivers/net/mdio/fwnode_mdio.c: In function ‘__fwnode_mdiobus_register’:
> drivers/net/mdio/fwnode_mdio.c:198:24: error: implicit declaration of
> function ‘__of_mdiobus_register’; did you mean ‘of_mdiobus_register’?
> [-Wimplicit-function-declaration]
> 198 | return __of_mdiobus_register(mdio,
> to_of_node(fwnode), owner);
Ah, thanks for a good catch. I haven't checked OF case to be off.
Yeah, with __acpi_mdiobus_register the compiler sees the prototype
independently on the configuration option. I will think about OF
case (like I said it can also be hidden, the problem is that there
is a huge amount of users, that's why I haven't touched it).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net-next v1 0/5] net: mdiobus: HIde ACPI implementation
@ 2026-05-04 7:29 Andy Shevchenko
2026-05-04 7:29 ` [PATCH net-next v1 1/5] net: mdiobus: Provide fwnode_mdiobus_register() Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2026-05-04 7:29 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel, netdev
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Heiner Kallweit, Russell King
This mini-series is dedicated to hiding ACPI implementation details
from the wider users as they (as of today) do not need to know that.
That also introduces the agnostic API that is preferred over OF /
ACPI / et cetera one.
I haven't tried to unify __*_mdiobus_register() as it seems using
something that may differ in ACPI vs. OF cases, it can be done later
on, if one knows how to do that with all the details.
The change has been compile tested (including configurations with
CONFIG_ACPI=n).
Andy Shevchenko (5):
net: mdiobus: Provide fwnode_mdiobus_register()
net: mvmdio: Switch to using fwnode_mdiobus_register()
net/fsl: xgmac_mdio: Switch to using fwnode_mdiobus_register()
net/fsl: xgmac_mdio: Reuse existing pointer to fwnode
net: mdiobus: Hide acpi_mdio.h
drivers/net/ethernet/freescale/xgmac_mdio.c | 23 +++++---------
drivers/net/ethernet/marvell/mvmdio.c | 11 ++-----
drivers/net/mdio/acpi_mdio.c | 3 +-
drivers/net/mdio/fwnode_mdio.c | 16 ++++++++++
drivers/net/mdio/mdio.h | 4 +++
include/linux/acpi_mdio.h | 33 ---------------------
include/linux/fwnode_mdio.h | 17 +++++++++++
7 files changed, 49 insertions(+), 58 deletions(-)
create mode 100644 drivers/net/mdio/mdio.h
delete mode 100644 include/linux/acpi_mdio.h
--
2.50.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net-next v1 1/5] net: mdiobus: Provide fwnode_mdiobus_register()
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
0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2026-05-04 7:29 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel, netdev
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Heiner Kallweit, Russell King
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-04 14:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
-- strict thread matches above, loose matches on Subject: below --
2026-05-04 7:29 [PATCH net-next v1 0/5] net: mdiobus: HIde ACPI implementation Andy Shevchenko
2026-05-04 7:29 ` [PATCH net-next v1 1/5] net: mdiobus: Provide fwnode_mdiobus_register() Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox