diff options
Diffstat (limited to '')
-rw-r--r-- | drivers/net/phy/phy_caps.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/phy/phy_caps.c b/drivers/net/phy/phy_caps.c index 0366feee2912..fc1568f83c1a 100644 --- a/drivers/net/phy/phy_caps.c +++ b/drivers/net/phy/phy_caps.c @@ -251,3 +251,17 @@ bool phy_caps_valid(int speed, int duplex, const unsigned long *linkmodes) return linkmode_intersects(link_caps[capa].linkmodes, linkmodes); } + +/** + * phy_caps_linkmodes() - Convert a bitfield of capabilities into linkmodes + * @caps: The list of caps, each bit corresponding to a LINK_CAPA value + * @linkmodes: The set of linkmodes to fill. Must be previously initialized. + */ +void phy_caps_linkmodes(unsigned long caps, unsigned long *linkmodes) +{ + unsigned long capa; + + for_each_set_bit(capa, &caps, __LINK_CAPA_MAX) + linkmode_or(linkmodes, linkmodes, link_caps[capa].linkmodes); +} +EXPORT_SYMBOL_GPL(phy_caps_linkmodes); |