Commit 0893bf6b authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Jakub Kicinski
Browse files

net: phy: simplify mdiobus_setup_mdiodev_from_board_info



- Move declaration of variable bi into list_for_each_entry_safe()
- The return value of cb() effectively isn't used, this allows to simplify
  the code.

Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/f6bbe242-b43d-4c2b-8c51-2cb2cefbaf59@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 08207f42
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -26,24 +26,18 @@ void mdiobus_setup_mdiodev_from_board_info(struct mii_bus *bus,
					   (struct mii_bus *bus,
					    struct mdio_board_info *bi))
{
	struct mdio_board_entry *be;
	struct mdio_board_entry *tmp;
	struct mdio_board_info *bi;
	int ret;
	struct mdio_board_entry *be, *tmp;

	mutex_lock(&mdio_board_lock);
	list_for_each_entry_safe(be, tmp, &mdio_board_list, list) {
		bi = &be->board_info;
		struct mdio_board_info *bi = &be->board_info;

		if (strcmp(bus->id, bi->bus_id))
			continue;

		mutex_unlock(&mdio_board_lock);
		ret = cb(bus, bi);
		cb(bus, bi);
		mutex_lock(&mdio_board_lock);
		if (ret)
			continue;

	}
	mutex_unlock(&mdio_board_lock);
}