Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: phy: remove mdio_board_info support from phylib

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>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
b67a8631 41357bc7

+1 -141
+1 -1
drivers/net/phy/Makefile
··· 8 8 9 9 ifdef CONFIG_PHYLIB 10 10 # built-in whenever PHYLIB is built-in or module 11 - obj-y += stubs.o mdio-boardinfo.o 11 + obj-y += stubs.o 12 12 endif 13 13 14 14 libphy-$(CONFIG_SWPHY) += swphy.o
-79
drivers/net/phy/mdio-boardinfo.c
··· 1 - // SPDX-License-Identifier: GPL-2.0+ 2 - /* 3 - * mdio-boardinfo - Collect pre-declarations for MDIO devices 4 - */ 5 - 6 - #include <linux/export.h> 7 - #include <linux/kernel.h> 8 - #include <linux/list.h> 9 - #include <linux/mutex.h> 10 - #include <linux/phy.h> 11 - #include <linux/slab.h> 12 - 13 - #include "mdio-boardinfo.h" 14 - 15 - static LIST_HEAD(mdio_board_list); 16 - static DEFINE_MUTEX(mdio_board_lock); 17 - 18 - struct mdio_board_entry { 19 - struct list_head list; 20 - struct mdio_board_info board_info; 21 - }; 22 - 23 - /** 24 - * mdiobus_setup_mdiodev_from_board_info - create and setup MDIO devices 25 - * from pre-collected board specific MDIO information 26 - * @bus: Bus the board_info belongs to 27 - * @cb: Callback to create device on bus 28 - * Context: can sleep 29 - */ 30 - void mdiobus_setup_mdiodev_from_board_info(struct mii_bus *bus, 31 - int (*cb) 32 - (struct mii_bus *bus, 33 - struct mdio_board_info *bi)) 34 - { 35 - struct mdio_board_entry *be, *tmp; 36 - 37 - mutex_lock(&mdio_board_lock); 38 - list_for_each_entry_safe(be, tmp, &mdio_board_list, list) { 39 - struct mdio_board_info *bi = &be->board_info; 40 - 41 - if (strcmp(bus->id, bi->bus_id)) 42 - continue; 43 - 44 - mutex_unlock(&mdio_board_lock); 45 - cb(bus, bi); 46 - mutex_lock(&mdio_board_lock); 47 - } 48 - mutex_unlock(&mdio_board_lock); 49 - } 50 - EXPORT_SYMBOL(mdiobus_setup_mdiodev_from_board_info); 51 - 52 - /** 53 - * mdiobus_register_board_info - register MDIO devices for a given board 54 - * @info: array of devices descriptors 55 - * @n: number of descriptors provided 56 - * Context: can sleep 57 - * 58 - * The board info passed can be marked with __initdata but be pointers 59 - * such as platform_data etc. are copied as-is 60 - */ 61 - int mdiobus_register_board_info(const struct mdio_board_info *info, 62 - unsigned int n) 63 - { 64 - struct mdio_board_entry *be; 65 - 66 - be = kcalloc(n, sizeof(*be), GFP_KERNEL); 67 - if (!be) 68 - return -ENOMEM; 69 - 70 - for (int i = 0; i < n; i++, be++) { 71 - be->board_info = info[i]; 72 - mutex_lock(&mdio_board_lock); 73 - list_add_tail(&be->list, &mdio_board_list); 74 - mutex_unlock(&mdio_board_lock); 75 - } 76 - 77 - return 0; 78 - } 79 - EXPORT_SYMBOL(mdiobus_register_board_info);
-18
drivers/net/phy/mdio-boardinfo.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * mdio-boardinfo.h - board info interface internal to the mdio_bus 4 - * component 5 - */ 6 - 7 - #ifndef __MDIO_BOARD_INFO_H 8 - #define __MDIO_BOARD_INFO_H 9 - 10 - struct mii_bus; 11 - struct mdio_board_info; 12 - 13 - void mdiobus_setup_mdiodev_from_board_info(struct mii_bus *bus, 14 - int (*cb) 15 - (struct mii_bus *bus, 16 - struct mdio_board_info *bi)); 17 - 18 - #endif /* __MDIO_BOARD_INFO_H */
-33
drivers/net/phy/mdio_bus_provider.c
··· 29 29 #include <linux/uaccess.h> 30 30 #include <linux/unistd.h> 31 31 32 - #include "mdio-boardinfo.h" 33 - 34 32 /** 35 33 * mdiobus_alloc_size - allocate a mii_bus structure 36 34 * @size: extra amount of memory to allocate for private storage. ··· 129 131 of_mdiobus_find_phy(dev, mdiodev, bus->dev.of_node); 130 132 } 131 133 #endif 132 - 133 - /** 134 - * mdiobus_create_device - create a full MDIO device given 135 - * a mdio_board_info structure 136 - * @bus: MDIO bus to create the devices on 137 - * @bi: mdio_board_info structure describing the devices 138 - * 139 - * Returns 0 on success or < 0 on error. 140 - */ 141 - static int mdiobus_create_device(struct mii_bus *bus, 142 - struct mdio_board_info *bi) 143 - { 144 - struct mdio_device *mdiodev; 145 - int ret = 0; 146 - 147 - mdiodev = mdio_device_create(bus, bi->mdio_addr); 148 - if (IS_ERR(mdiodev)) 149 - return -ENODEV; 150 - 151 - strscpy(mdiodev->modalias, bi->modalias, 152 - sizeof(mdiodev->modalias)); 153 - mdiodev->dev.platform_data = (void *)bi->platform_data; 154 - 155 - ret = mdio_device_register(mdiodev); 156 - if (ret) 157 - mdio_device_free(mdiodev); 158 - 159 - return ret; 160 - } 161 134 162 135 static struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr, bool c45) 163 136 { ··· 372 403 if (err) 373 404 goto error; 374 405 } 375 - 376 - mdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device); 377 406 378 407 bus->state = MDIOBUS_REGISTERED; 379 408 dev_dbg(&bus->dev, "probed\n");
-10
include/linux/phy.h
··· 2129 2129 extern const struct bus_type mdio_bus_type; 2130 2130 extern const struct class mdio_bus_class; 2131 2131 2132 - struct mdio_board_info { 2133 - const char *bus_id; 2134 - char modalias[MDIO_NAME_SIZE]; 2135 - int mdio_addr; 2136 - const void *platform_data; 2137 - }; 2138 - 2139 - int mdiobus_register_board_info(const struct mdio_board_info *info, 2140 - unsigned int n); 2141 - 2142 2132 /** 2143 2133 * phy_module_driver() - Helper macro for registering PHY drivers 2144 2134 * @__phy_drivers: array of PHY drivers to register