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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-phy-improve-mdio-boardinfo-handling'

Heiner Kallweit says:

====================
net: phy: improve mdio-boardinfo handling

This series includes smaller improvements to mdio-boardinfo handling.
====================

Link: https://patch.msgid.link/6ae7bda0-c093-468a-8ac0-50a2afa73c45@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+16 -22
+14 -15
drivers/net/phy/mdio-boardinfo.c
··· 3 3 * mdio-boardinfo - Collect pre-declarations for MDIO devices 4 4 */ 5 5 6 - #include <linux/kernel.h> 7 - #include <linux/slab.h> 8 6 #include <linux/export.h> 9 - #include <linux/mutex.h> 7 + #include <linux/kernel.h> 10 8 #include <linux/list.h> 9 + #include <linux/mutex.h> 10 + #include <linux/phy.h> 11 + #include <linux/slab.h> 11 12 12 13 #include "mdio-boardinfo.h" 13 14 14 15 static LIST_HEAD(mdio_board_list); 15 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 + }; 16 22 17 23 /** 18 24 * mdiobus_setup_mdiodev_from_board_info - create and setup MDIO devices ··· 32 26 (struct mii_bus *bus, 33 27 struct mdio_board_info *bi)) 34 28 { 35 - struct mdio_board_entry *be; 36 - struct mdio_board_entry *tmp; 37 - struct mdio_board_info *bi; 38 - int ret; 29 + struct mdio_board_entry *be, *tmp; 39 30 40 31 mutex_lock(&mdio_board_lock); 41 32 list_for_each_entry_safe(be, tmp, &mdio_board_list, list) { 42 - bi = &be->board_info; 33 + struct mdio_board_info *bi = &be->board_info; 43 34 44 35 if (strcmp(bus->id, bi->bus_id)) 45 36 continue; 46 37 47 38 mutex_unlock(&mdio_board_lock); 48 - ret = cb(bus, bi); 39 + cb(bus, bi); 49 40 mutex_lock(&mdio_board_lock); 50 - if (ret) 51 - continue; 52 - 53 41 } 54 42 mutex_unlock(&mdio_board_lock); 55 43 } ··· 62 62 unsigned int n) 63 63 { 64 64 struct mdio_board_entry *be; 65 - unsigned int i; 66 65 67 66 be = kcalloc(n, sizeof(*be), GFP_KERNEL); 68 67 if (!be) 69 68 return -ENOMEM; 70 69 71 - for (i = 0; i < n; i++, be++, info++) { 72 - memcpy(&be->board_info, info, sizeof(*info)); 70 + for (int i = 0; i < n; i++, be++) { 71 + be->board_info = info[i]; 73 72 mutex_lock(&mdio_board_lock); 74 73 list_add_tail(&be->list, &mdio_board_list); 75 74 mutex_unlock(&mdio_board_lock);
+2 -7
drivers/net/phy/mdio-boardinfo.h
··· 7 7 #ifndef __MDIO_BOARD_INFO_H 8 8 #define __MDIO_BOARD_INFO_H 9 9 10 - #include <linux/phy.h> 11 - #include <linux/mutex.h> 12 - 13 - struct mdio_board_entry { 14 - struct list_head list; 15 - struct mdio_board_info board_info; 16 - }; 10 + struct mii_bus; 11 + struct mdio_board_info; 17 12 18 13 void mdiobus_setup_mdiodev_from_board_info(struct mii_bus *bus, 19 14 int (*cb)