diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2017-03-27 23:56:10 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2017-05-05 18:42:38 +0100 |
commit | 093fec57fc2c75e1c21c2259b18ec8456f1ba7c9 (patch) | |
tree | d540f3b0df09c615cf391f3c8c2b4bfb25ac07ac | |
parent | 52696c4261659c289ae9c0f418f025372bea1e2d (diff) |
net: phy: simplify phy_supported_speeds()
Simplify the loop in phy_supported_speeds().
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-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 e98b6e275ed7..57db2104e2b4 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -306,17 +306,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; } |