diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2017-04-13 16:49:20 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-17 13:25:07 -0400 |
commit | 786df9c2a4216e64e5b7c321405d706036a76ba3 (patch) | |
tree | 980fa1cbda64be1b67087e846e0c3be78c851bbe /drivers/net/phy | |
parent | d06130377c4826624681505c0bb45bfd6eb7cd4f (diff) | |
download | linux-786df9c2a4216e64e5b7c321405d706036a76ba3.tar.gz linux-786df9c2a4216e64e5b7c321405d706036a76ba3.tar.bz2 linux-786df9c2a4216e64e5b7c321405d706036a76ba3.zip |
net: phy: simplify phy_supported_speeds()
Simplify the loop in phy_supported_speeds().
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/phy.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 00280d4eeb56..6afbd973a779 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -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; } |