[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb8081d413df4a008e32358b23732dd4@AcuMS.aculab.com>
Date: Fri, 11 Feb 2022 09:01:18 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Yury Norov' <yury.norov@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Andrew Morton <akpm@...ux-foundation.org>,
Michał Mirosław <mirq-linux@...e.qmqm.pl>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Joe Perches <joe@...ches.com>, Dennis Zhou <dennis@...nel.org>,
Emil Renner Berthing <kernel@...il.dk>,
Nicholas Piggin <npiggin@...il.com>,
Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Alexey Klimov <aklimov@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Amit Kucheria <amitk@...nel.org>,
Zhang Rui <rui.zhang@...el.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Rikard Falkeborn <rikard.falkeborn@...il.com>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>
CC: Tariq Toukan <tariqt@...dia.com>
Subject: RE: [PATCH 03/49] net: mellanox: fix open-coded for_each_set_bit()
From: Yury Norov
> Sent: 10 February 2022 22:49
>
> Mellanox driver has an open-coded for_each_set_bit(). Fix it.
>
> Signed-off-by: Yury Norov <yury.norov@...il.com>
> Reviewed-by: Tariq Toukan <tariqt@...dia.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/cmd.c | 23 ++++++-----------------
> 1 file changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
> index e10b7b04b894..c56d2194cbfc 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
> @@ -1994,21 +1994,16 @@ static void mlx4_allocate_port_vpps(struct mlx4_dev *dev, int port)
>
> static int mlx4_master_activate_admin_state(struct mlx4_priv *priv, int slave)
> {
> - int port, err;
> + int p, port, err;
> struct mlx4_vport_state *vp_admin;
> struct mlx4_vport_oper_state *vp_oper;
> struct mlx4_slave_state *slave_state =
> &priv->mfunc.master.slave_state[slave];
> struct mlx4_active_ports actv_ports = mlx4_get_active_ports(
> &priv->dev, slave);
> - int min_port = find_first_bit(actv_ports.ports,
> - priv->dev.caps.num_ports) + 1;
> - int max_port = min_port - 1 +
> - bitmap_weight(actv_ports.ports, priv->dev.caps.num_ports);
>
> - for (port = min_port; port <= max_port; port++) {
> - if (!test_bit(port - 1, actv_ports.ports))
> - continue;
> + for_each_set_bit(p, actv_ports.ports, priv->dev.caps.num_ports) {
> + port = p + 1;
This is an 'interesting' change in behaviour, and looks like a bug fix.
Did anyone actually test the old code?
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists