Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 786df9c2 authored by Russell King's avatar Russell King Committed by David S. Miller
Browse files

net: phy: simplify phy_supported_speeds()



Simplify the loop in phy_supported_speeds().

Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d0613037
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -320,17 +320,11 @@ unsigned int phy_supported_speeds(struct phy_device *phy,
	unsigned int count = 0;
	unsigned int idx = 0;

	for (idx = 0; idx < ARRAY_SIZE(settings) && count < size; idx++) {
		if (!(settings[idx].setting & phy->supported))
			continue;

	for (idx = 0; idx < ARRAY_SIZE(settings) && count < size; idx++)
		/* Assumes settings are grouped by speed */
		if ((count == 0) ||
		    (speeds[count - 1] != settings[idx].speed)) {
			speeds[count] = settings[idx].speed;
			count++;
		}
	}
		if ((settings[idx].setting & phy->supported) &&
		    (count == 0 || speeds[count - 1] != settings[idx].speed))
			speeds[count++] = settings[idx].speed;

	return count;
}