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>
This commit is contained in:
parent
d06130377c
commit
786df9c2a4
|
@ -320,17 +320,11 @@ unsigned int phy_supported_speeds(struct phy_device *phy,
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
|
|
||||||
for (idx = 0; idx < ARRAY_SIZE(settings) && count < size; idx++) {
|
for (idx = 0; idx < ARRAY_SIZE(settings) && count < size; idx++)
|
||||||
if (!(settings[idx].setting & phy->supported))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Assumes settings are grouped by speed */
|
/* Assumes settings are grouped by speed */
|
||||||
if ((count == 0) ||
|
if ((settings[idx].setting & phy->supported) &&
|
||||||
(speeds[count - 1] != settings[idx].speed)) {
|
(count == 0 || speeds[count - 1] != settings[idx].speed))
|
||||||
speeds[count] = settings[idx].speed;
|
speeds[count++] = settings[idx].speed;
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue