Commit 554032cd authored by Russell King's avatar Russell King Committed by David S. Miller

net: phylink: use more linkmode_*

Use more linkmode_* helpers rather than open-coding the bitmap
operations.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4980b2c4
...@@ -117,9 +117,7 @@ static int phylink_is_empty_linkmode(const unsigned long *linkmode) ...@@ -117,9 +117,7 @@ static int phylink_is_empty_linkmode(const unsigned long *linkmode)
phylink_set(tmp, Pause); phylink_set(tmp, Pause);
phylink_set(tmp, Asym_Pause); phylink_set(tmp, Asym_Pause);
bitmap_andnot(tmp, linkmode, tmp, __ETHTOOL_LINK_MODE_MASK_NBITS); return linkmode_subset(linkmode, tmp);
return linkmode_empty(tmp);
} }
static const char *phylink_an_mode_str(unsigned int mode) static const char *phylink_an_mode_str(unsigned int mode)
...@@ -1728,8 +1726,7 @@ static int phylink_sfp_module_insert(void *upstream, ...@@ -1728,8 +1726,7 @@ static int phylink_sfp_module_insert(void *upstream,
if (phy_interface_mode_is_8023z(iface) && pl->phydev) if (phy_interface_mode_is_8023z(iface) && pl->phydev)
return -EINVAL; return -EINVAL;
changed = !bitmap_equal(pl->supported, support, changed = !linkmode_equal(pl->supported, support);
__ETHTOOL_LINK_MODE_MASK_NBITS);
if (changed) { if (changed) {
linkmode_copy(pl->supported, support); linkmode_copy(pl->supported, support);
linkmode_copy(pl->link_config.advertising, config.advertising); linkmode_copy(pl->link_config.advertising, config.advertising);
......
...@@ -82,4 +82,10 @@ static inline int linkmode_equal(const unsigned long *src1, ...@@ -82,4 +82,10 @@ static inline int linkmode_equal(const unsigned long *src1,
return bitmap_equal(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS); return bitmap_equal(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);
} }
static inline int linkmode_subset(const unsigned long *src1,
const unsigned long *src2)
{
return bitmap_subset(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);
}
#endif /* __LINKMODE_H */ #endif /* __LINKMODE_H */
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