提交 786df9c2 编写于 作者: R Russell King 提交者: David S. Miller

net: phy: simplify phy_supported_speeds()

Simplify the loop in phy_supported_speeds().
Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d0613037
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册