Commit 7b261e0e authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Jakub Kicinski

net: phy: add __set_linkmode_max_speed

We will need the functionality of __set_linkmode_max_speed also for
linkmode bitmaps other than phydev->supported. Therefore split it.

v2:
- remove unused parameter from __set_linkmode_max_speed
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
parent 043b8413
...@@ -207,14 +207,14 @@ size_t phy_speeds(unsigned int *speeds, size_t size, ...@@ -207,14 +207,14 @@ size_t phy_speeds(unsigned int *speeds, size_t size,
return count; return count;
} }
static int __set_phy_supported(struct phy_device *phydev, u32 max_speed) static int __set_linkmode_max_speed(u32 max_speed, unsigned long *addr)
{ {
const struct phy_setting *p; const struct phy_setting *p;
int i; int i;
for (i = 0, p = settings; i < ARRAY_SIZE(settings); i++, p++) { for (i = 0, p = settings; i < ARRAY_SIZE(settings); i++, p++) {
if (p->speed > max_speed) if (p->speed > max_speed)
linkmode_clear_bit(p->bit, phydev->supported); linkmode_clear_bit(p->bit, addr);
else else
break; break;
} }
...@@ -222,6 +222,11 @@ static int __set_phy_supported(struct phy_device *phydev, u32 max_speed) ...@@ -222,6 +222,11 @@ static int __set_phy_supported(struct phy_device *phydev, u32 max_speed)
return 0; return 0;
} }
static int __set_phy_supported(struct phy_device *phydev, u32 max_speed)
{
return __set_linkmode_max_speed(max_speed, phydev->supported);
}
int phy_set_max_speed(struct phy_device *phydev, u32 max_speed) int phy_set_max_speed(struct phy_device *phydev, u32 max_speed)
{ {
int err; int err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment