]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: phy: remove mdio_board_info support from phylib
authorHeiner Kallweit <hkallweit1@gmail.com>
Sat, 13 Sep 2025 21:08:17 +0000 (23:08 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 17 Sep 2025 22:24:01 +0000 (15:24 -0700)
After having removed mdio_board_info usage from dsa_loop, there's no
user left. So let's drop support for it from phylib.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/01542a2e-05f5-4f13-acef-72632b33b5be@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/Makefile
drivers/net/phy/mdio-boardinfo.c [deleted file]
drivers/net/phy/mdio-boardinfo.h [deleted file]
drivers/net/phy/mdio_bus_provider.c
include/linux/phy.h

index 402a33d559de6a1b1332e20b4afaaf34c2b61cfb..76e0db40f879c6dc04de50da9f87fa70f201b427 100644 (file)
@@ -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
diff --git a/drivers/net/phy/mdio-boardinfo.c b/drivers/net/phy/mdio-boardinfo.c
deleted file mode 100644 (file)
index d3184e8..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * mdio-boardinfo - Collect pre-declarations for MDIO devices
- */
-
-#include <linux/export.h>
-#include <linux/kernel.h>
-#include <linux/list.h>
-#include <linux/mutex.h>
-#include <linux/phy.h>
-#include <linux/slab.h>
-
-#include "mdio-boardinfo.h"
-
-static LIST_HEAD(mdio_board_list);
-static DEFINE_MUTEX(mdio_board_lock);
-
-struct mdio_board_entry {
-       struct list_head        list;
-       struct mdio_board_info  board_info;
-};
-
-/**
- * mdiobus_setup_mdiodev_from_board_info - create and setup MDIO devices
- * from pre-collected board specific MDIO information
- * @bus: Bus the board_info belongs to
- * @cb: Callback to create device on bus
- * Context: can sleep
- */
-void mdiobus_setup_mdiodev_from_board_info(struct mii_bus *bus,
-                                          int (*cb)
-                                          (struct mii_bus *bus,
-                                           struct mdio_board_info *bi))
-{
-       struct mdio_board_entry *be, *tmp;
-
-       mutex_lock(&mdio_board_lock);
-       list_for_each_entry_safe(be, tmp, &mdio_board_list, list) {
-               struct mdio_board_info *bi = &be->board_info;
-
-               if (strcmp(bus->id, bi->bus_id))
-                       continue;
-
-               mutex_unlock(&mdio_board_lock);
-               cb(bus, bi);
-               mutex_lock(&mdio_board_lock);
-       }
-       mutex_unlock(&mdio_board_lock);
-}
-EXPORT_SYMBOL(mdiobus_setup_mdiodev_from_board_info);
-
-/**
- * mdiobus_register_board_info - register MDIO devices for a given board
- * @info: array of devices descriptors
- * @n: number of descriptors provided
- * Context: can sleep
- *
- * The board info passed can be marked with __initdata but be pointers
- * such as platform_data etc. are copied as-is
- */
-int mdiobus_register_board_info(const struct mdio_board_info *info,
-                               unsigned int n)
-{
-       struct mdio_board_entry *be;
-
-       be = kcalloc(n, sizeof(*be), GFP_KERNEL);
-       if (!be)
-               return -ENOMEM;
-
-       for (int i = 0; i < n; i++, be++) {
-               be->board_info = info[i];
-               mutex_lock(&mdio_board_lock);
-               list_add_tail(&be->list, &mdio_board_list);
-               mutex_unlock(&mdio_board_lock);
-       }
-
-       return 0;
-}
-EXPORT_SYMBOL(mdiobus_register_board_info);
diff --git a/drivers/net/phy/mdio-boardinfo.h b/drivers/net/phy/mdio-boardinfo.h
deleted file mode 100644 (file)
index 0878b77..0000000
+++ /dev/null
@@ -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 */
index f43973e73ea3ac5620a95542a65d546a060afc46..a2391d4b7e5c8fc6293fec46924c11f39b35a9c6 100644 (file)
@@ -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;
index 6f3b25cb7f4e8b2d3d48f83e8ec6c70de4826b82..7da9e19471c93d0b0c12be6b2d76ee045010ee6f 100644 (file)
@@ -2129,16 +2129,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