[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87mtgp9w34.fsf@gmail.com>
Date: Wed, 13 Apr 2022 11:22:23 +0200
From: Joachim Wiberg <troglobit@...il.com>
To: Nikolay Aleksandrov <razor@...ckwall.org>,
Roopa Prabhu <roopa@...dia.com>
Cc: netdev@...r.kernel.org, bridge@...ts.linux-foundation.org,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Tobias Waldekranz <tobias@...dekranz.com>,
Vladimir Oltean <vladimir.oltean@....com>
Subject: Re: [PATCH RFC net-next 03/13] net: bridge: minor refactor of br_setlink() for readability
On Tue, Apr 12, 2022 at 21:36, Nikolay Aleksandrov <razor@...ckwall.org> wrote:
> On 11/04/2022 16:38, Joachim Wiberg wrote:
>> The br_setlink() function extracts the struct net_bridge pointer a bit
>> sloppy. It's easy to interpret the code wrong. This patch attempts to
>> clear things up a bit.
> I think you can make it more straight-forward, remove the first br = netdev_priv
> and do something like (completely untested):
> ...
> struct net_bridge_port *p = NULL;
> ...
> if (netif_is_bridge_master(dev)) {
> br = netdev_priv(dev);
> } else {
> p = br_port_get_rtnl(dev);
> if (WARN_ON(!p))
> return -EINVAL;
> br = p->br;
> }
>
> So br is always and only set in this block.
Yes, this is much better, thank you! I took the misguided approach of
minmizing my change. I'll update and include in the non-RFC patch
series I send next.
Powered by blists - more mailing lists