[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8c1c67df-945f-44eb-8344-81cbaecb6ae8@intel.com>
Date: Mon, 20 Nov 2023 13:04:51 +0100
From: Wojciech Drewek <wojciech.drewek@...el.com>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>, Andrew Lunn
<andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>
CC: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next v2] net: phylink: use for_each_set_bit()
On 19.11.2023 22:07, Russell King (Oracle) wrote:
> Use for_each_set_bit() rather than open coding the for() test_bit()
> loop.
>
> Reviewed-by: Andrew Lunn <andrew@...n.ch>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> ---
Nice cleanup,
Reviewed-by: Wojciech Drewek <wojciech.drewek@...el.com>
> drivers/net/phy/phylink.c | 18 ++++++++----------
> 1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index d2fa949ff1ea..c276f9482f78 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -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);
> }
> }
>
Powered by blists - more mailing lists