Skip to content

Commit 554032c

Browse files
Russell Kingdavem330
authored andcommitted
net: phylink: use more linkmode_*
Use more linkmode_* helpers rather than open-coding the bitmap operations. Signed-off-by: Russell King <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4980b2c commit 554032c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

drivers/net/phy/phylink.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ static int phylink_is_empty_linkmode(const unsigned long *linkmode)
117117
phylink_set(tmp, Pause);
118118
phylink_set(tmp, Asym_Pause);
119119

120-
bitmap_andnot(tmp, linkmode, tmp, __ETHTOOL_LINK_MODE_MASK_NBITS);
121-
122-
return linkmode_empty(tmp);
120+
return linkmode_subset(linkmode, tmp);
123121
}
124122

125123
static const char *phylink_an_mode_str(unsigned int mode)
@@ -1728,8 +1726,7 @@ static int phylink_sfp_module_insert(void *upstream,
17281726
if (phy_interface_mode_is_8023z(iface) && pl->phydev)
17291727
return -EINVAL;
17301728

1731-
changed = !bitmap_equal(pl->supported, support,
1732-
__ETHTOOL_LINK_MODE_MASK_NBITS);
1729+
changed = !linkmode_equal(pl->supported, support);
17331730
if (changed) {
17341731
linkmode_copy(pl->supported, support);
17351732
linkmode_copy(pl->link_config.advertising, config.advertising);

include/linux/linkmode.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,10 @@ static inline int linkmode_equal(const unsigned long *src1,
8282
return bitmap_equal(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);
8383
}
8484

85+
static inline int linkmode_subset(const unsigned long *src1,
86+
const unsigned long *src2)
87+
{
88+
return bitmap_subset(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);
89+
}
90+
8591
#endif /* __LINKMODE_H */

0 commit comments

Comments
 (0)