Skip to contentSkip to conversation

net: phy: remove mdio_board_info support from phylib

PATCH Applied Heiner Kallweit 3 participants 5 messages Sep 13, 2025 – Sep 17, 2025

Subsystems (4)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

cover net: phy: remove mdio_board_info support from phylib

Since its introduction in 2017 mdio_board_info has had only two users:
- dsa_loop (still existing)
- arm orion, added in 2017 and removed with fd68572b57f2 ("ARM: orion5x:
remove dsa_chip_data references")

So let's remove usage of mdio_board_info from dsa_loop, then support for mdio_board_info can be dropped from phylib.

Heiner Kallweit (2):
net: dsa: dsa_loop: remove usage of mdio_board_info
net: phy: remove mdio_board_info support from phylib

 drivers/net/dsa/Makefile            |  3 --
 drivers/net/dsa/dsa_loop.c          | 63 +++++++++++++++++++++--
 drivers/net/dsa/dsa_loop.h          | 20 --------
 drivers/net/dsa/dsa_loop_bdinfo.c   | 36 -------------
 drivers/net/phy/Makefile            |  2 +-
 drivers/net/phy/mdio-boardinfo.c    | 79 -----------------------------
 drivers/net/phy/mdio-boardinfo.h    | 18 -------
 drivers/net/phy/mdio_bus_provider.c | 33 ------------
 include/linux/phy.h                 | 10 ----
 9 files changed, 61 insertions(+), 203 deletions(-)
 delete mode 100644 drivers/net/dsa/dsa_loop.h
 delete mode 100644 drivers/net/dsa/dsa_loop_bdinfo.c
 delete mode 100644 drivers/net/phy/mdio-boardinfo.c
 delete mode 100644 drivers/net/phy/mdio-boardinfo.h
Signature · 1 line
2.51.0
author maintainer
#1 lore raw

PATCH 1/2 net: dsa: dsa_loop: remove usage of mdio_board_info

dsa_loop is the last remaining user of mdio_board_info. Let's remove using mdio_board_info, so that support for it can be dropped from phylib.

---
 drivers/net/dsa/Makefile          |  3 --
 drivers/net/dsa/dsa_loop.c        | 63 +++++++++++++++++++++++++++++--
 drivers/net/dsa/dsa_loop.h        | 20 ----------
 drivers/net/dsa/dsa_loop_bdinfo.c | 36 ------------------
 4 files changed, 60 insertions(+), 62 deletions(-)
 delete mode 100644 drivers/net/dsa/dsa_loop.h
 delete mode 100644 drivers/net/dsa/dsa_loop_bdinfo.c
drivers/net/dsa/Makefile +0 -3
index c0a534fe6..0f8ff4a1a 100644
@@ -2,9 +2,6 @@
 obj-$(CONFIG_NET_DSA_BCM_SF2)	+= bcm-sf2.o
 bcm-sf2-objs			:= bcm_sf2.o bcm_sf2_cfp.o
 obj-$(CONFIG_NET_DSA_LOOP)	+= dsa_loop.o
-ifdef CONFIG_NET_DSA_LOOP
-obj-$(CONFIG_FIXED_PHY)		+= dsa_loop_bdinfo.o
-endif
 obj-$(CONFIG_NET_DSA_KS8995) 	+= ks8995.o
 obj-$(CONFIG_NET_DSA_MT7530)	+= mt7530.o
 obj-$(CONFIG_NET_DSA_MT7530_MDIO) += mt7530-mdio.o
drivers/net/dsa/dsa_loop.c +60 -3

101 lines not on this page · raw message

drivers/net/dsa/dsa_loop.h deleted +0 -20
deleted file mode 100644
index 93e5c15d0..000000000
@@ -1,20 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __DSA_LOOP_H
-#define __DSA_LOOP_H
-
-struct dsa_chip_data;
-
-struct dsa_loop_pdata {
-	/* Must be first, such that dsa_register_switch() can access this
-	 * without gory pointer manipulations
-	 */
-	struct dsa_chip_data cd;
-	const char *name;
-	unsigned int enabled_ports;
-	const char *netdev;
-};
-
-#define DSA_LOOP_NUM_PORTS	6
-#define DSA_LOOP_CPU_PORT	(DSA_LOOP_NUM_PORTS - 1)
-
-#endif /* __DSA_LOOP_H */
drivers/net/dsa/dsa_loop_bdinfo.c deleted +0 -36
deleted file mode 100644
index 14ca42491..000000000
@@ -1,36 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/phy.h>
-#include <net/dsa.h>
-
-#include "dsa_loop.h"
-
-static struct dsa_loop_pdata dsa_loop_pdata = {
-	.cd = {
-		.port_names[0] = "lan1",
-		.port_names[1] = "lan2",
-		.port_names[2] = "lan3",
-		.port_names[3] = "lan4",
-		.port_names[DSA_LOOP_CPU_PORT] = "cpu",
-	},
-	.name = "DSA mockup driver",
-	.enabled_ports = 0x1f,
-	.netdev = "eth0",
-};
-
-static const struct mdio_board_info bdinfo = {
-	.bus_id	= "fixed-0",
-	.modalias = "dsa-loop",
-	.mdio_addr = 31,
-	.platform_data = &dsa_loop_pdata,
-};
-
-static int __init dsa_loop_bdinfo_init(void)
-{
-	return mdiobus_register_board_info(&bdinfo, 1);
-}
-arch_initcall(dsa_loop_bdinfo_init)
-
-MODULE_DESCRIPTION("DSA mock-up switch driver");
-MODULE_LICENSE("GPL");
Signature · 1 line
2.51.0
maintainer Reviewed-by Tested-by on v1 1/2
#2 lore raw

Re: [PATCH net-next 1/2] net: dsa: dsa_loop: remove usage of mdio_board_info

Quoted 6 lines · Heiner Kallweit

dsa_loop is the last remaining user of mdio_board_info. Let's remove using mdio_board_info, so that support for it can be dropped from phylib.

---

Thanks for the conversion! It looks really good.

author maintainer
#3 lore raw

PATCH 2/2 net: phy: remove mdio_board_info support from phylib

In reply to Heiner Kallweit

After having removed mdio_board_info usage from dsa_loop, there's no user left. So let's drop support for it from phylib.

---
 drivers/net/phy/Makefile            |  2 +-
 drivers/net/phy/mdio-boardinfo.c    | 79 -----------------------------
 drivers/net/phy/mdio-boardinfo.h    | 18 -------
 drivers/net/phy/mdio_bus_provider.c | 33 ------------
 include/linux/phy.h                 | 10 ----
 5 files changed, 1 insertion(+), 141 deletions(-)
 delete mode 100644 drivers/net/phy/mdio-boardinfo.c
 delete mode 100644 drivers/net/phy/mdio-boardinfo.h
drivers/net/phy/Makefile +1 -1
index 402a33d55..76e0db40f 100644
@@ -8,7 +8,7 @@ mdio-bus-y			+= mdio_bus.o mdio_device.o
 
 ifdef CONFIG_PHYLIB
 # built-in whenever PHYLIB is built-in or module
-obj-y				+= stubs.o mdio-boardinfo.o
+obj-y				+= stubs.o
 endif
 
 libphy-$(CONFIG_SWPHY)		+= swphy.o
drivers/net/phy/mdio-boardinfo.c deleted +0 -79

79 lines not on this page · raw message

drivers/net/phy/mdio-boardinfo.h deleted +0 -18
deleted file mode 100644
index 0878b7787..000000000
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * mdio-boardinfo.h - board info interface internal to the mdio_bus
- * component
- */
-
-#ifndef __MDIO_BOARD_INFO_H
-#define __MDIO_BOARD_INFO_H
-
-struct mii_bus;
-struct mdio_board_info;
-
-void mdiobus_setup_mdiodev_from_board_info(struct mii_bus *bus,
-					   int (*cb)
-					   (struct mii_bus *bus,
-					    struct mdio_board_info *bi));
-
-#endif /* __MDIO_BOARD_INFO_H */
drivers/net/phy/mdio_bus_provider.c +0 -33
index f43973e73..a2391d4b7 100644
@@ -29,8 +29,6 @@
 #include <linux/uaccess.h>
 #include <linux/unistd.h>
 
-#include "mdio-boardinfo.h"
-
 /**
  * mdiobus_alloc_size - allocate a mii_bus structure
  * @size: extra amount of memory to allocate for private storage.
@@ -132,35 +130,6 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus,
 }
 #endif
 
-/**
- * mdiobus_create_device - create a full MDIO device given
- * a mdio_board_info structure
- * @bus: MDIO bus to create the devices on
- * @bi: mdio_board_info structure describing the devices
- *
- * Returns 0 on success or < 0 on error.
- */
-static int mdiobus_create_device(struct mii_bus *bus,
-				 struct mdio_board_info *bi)
-{
-	struct mdio_device *mdiodev;
-	int ret = 0;
-
-	mdiodev = mdio_device_create(bus, bi->mdio_addr);
-	if (IS_ERR(mdiodev))
-		return -ENODEV;
-
-	strscpy(mdiodev->modalias, bi->modalias,
-		sizeof(mdiodev->modalias));
-	mdiodev->dev.platform_data = (void *)bi->platform_data;
-
-	ret = mdio_device_register(mdiodev);
-	if (ret)
-		mdio_device_free(mdiodev);
-
-	return ret;
-}
-
 static struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr, bool c45)
 {
 	struct phy_device *phydev = ERR_PTR(-ENODEV);
@@ -404,8 +373,6 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
 			goto error;
 	}
 
-	mdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device);
-
 	bus->state = MDIOBUS_REGISTERED;
 	dev_dbg(&bus->dev, "probed\n");
 	return 0;
include/linux/phy.h +0 -10
index 04553419a..249aee317 100644
@@ -2116,16 +2116,6 @@ int __phy_hwtstamp_set(struct phy_device *phydev,
 extern const struct bus_type mdio_bus_type;
 extern const struct class mdio_bus_class;
 
-struct mdio_board_info {
-	const char	*bus_id;
-	char		modalias[MDIO_NAME_SIZE];
-	int		mdio_addr;
-	const void	*platform_data;
-};
-
-int mdiobus_register_board_info(const struct mdio_board_info *info,
-				unsigned int n);
-
 /**
  * phy_module_driver() - Helper macro for registering PHY drivers
  * @__phy_drivers: array of PHY drivers to register
Signature · 1 line
2.51.0
#4 lore raw
In reply to Heiner Kallweit
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Sat, 13 Sep 2025 23:05:15 +0200 you wrote:

Since its introduction in 2017 mdio_board_info has had only two users:
- dsa_loop (still existing)
- arm orion, added in 2017 and removed with fd68572b57f2 ("ARM: orion5x:
remove dsa_chip_data references")

So let's remove usage of mdio_board_info from dsa_loop, then support for mdio_board_info can be dropped from phylib.

[...]

Here is the summary with links:
- [net-next,1/2] net: dsa: dsa_loop: remove usage of mdio_board_info

    https://git.kernel.org/netdev/net-next/c/41357bc7b94b
  - [net-next,2/2] net: phy: remove mdio_board_info support from phylib
    https://git.kernel.org/netdev/net-next/c/b67a8631a4a8

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html