Skip to content

Commit 3356628

Browse files
Russell King (Oracle)Paolo Abeni
authored andcommitted
net: phylink: use for_each_set_bit()
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>
1 parent 79a4f4d commit 3356628

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

drivers/net/phy/phylink.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -697,18 +697,16 @@ static int phylink_validate_mask(struct phylink *pl, unsigned long *supported,
697697
__ETHTOOL_DECLARE_LINK_MODE_MASK(all_s) = { 0, };
698698
__ETHTOOL_DECLARE_LINK_MODE_MASK(s);
699699
struct phylink_link_state t;
700-
int intf;
700+
int interface;
701701

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

706-
t = *state;
707-
t.interface = intf;
708-
if (!phylink_validate_mac_and_pcs(pl, s, &t)) {
709-
linkmode_or(all_s, all_s, s);
710-
linkmode_or(all_adv, all_adv, t.advertising);
711-
}
705+
t = *state;
706+
t.interface = interface;
707+
if (!phylink_validate_mac_and_pcs(pl, s, &t)) {
708+
linkmode_or(all_s, all_s, s);
709+
linkmode_or(all_adv, all_adv, t.advertising);
712710
}
713711
}
714712

0 commit comments

Comments
 (0)