Skip to content

Commit

Permalink
net: phylink: use for_each_set_bit()
Browse files Browse the repository at this point in the history
Use for_each_set_bit() rather than open coding the for() test_bit()
loop.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Link: https://lore.kernel.org/r/E1r4p15-00Cpxe-C7@rmk-PC.armlinux.org.uk
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Russell King (Oracle) authored and Paolo Abeni committed Nov 21, 2023
1 parent 79a4f4d commit 3356628
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions drivers/net/phy/phylink.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,18 +697,16 @@ static int phylink_validate_mask(struct phylink *pl, unsigned long *supported,
__ETHTOOL_DECLARE_LINK_MODE_MASK(all_s) = { 0, };
__ETHTOOL_DECLARE_LINK_MODE_MASK(s);
struct phylink_link_state t;
int intf;
int interface;

for (intf = 0; intf < PHY_INTERFACE_MODE_MAX; intf++) {
if (test_bit(intf, interfaces)) {
linkmode_copy(s, supported);
for_each_set_bit(interface, interfaces, PHY_INTERFACE_MODE_MAX) {
linkmode_copy(s, supported);

t = *state;
t.interface = intf;
if (!phylink_validate_mac_and_pcs(pl, s, &t)) {
linkmode_or(all_s, all_s, s);
linkmode_or(all_adv, all_adv, t.advertising);
}
t = *state;
t.interface = interface;
if (!phylink_validate_mac_and_pcs(pl, s, &t)) {
linkmode_or(all_s, all_s, s);
linkmode_or(all_adv, all_adv, t.advertising);
}
}

Expand Down

0 comments on commit 3356628

Please sign in to comment.